phamhoangthi Posted February 13, 2012 Share Posted February 13, 2012 This is a Simply code to login into Google account. $username = InputBox("Message","Type Acc") $password = InputBox("Message","Type Pass") $oIE = ObjCreate("InternetExplorer.Application") ; $oIE.visible = True ; show ie $oIE.Navigate("https://accounts.google.com/ServiceLogin?hl=en&continue=http://www.google.com.vn/") Sleep(10000) $oIE.document.getElementById("Email").value=$username ; input acc $oIE.document.getElementByName("Passwd").value=$password ; Input pass $oIE.document.getElementById("signIn").click ; click button Login >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Program Files\AutoIt3\googlelogin.au3" C:\Program Files\AutoIt3\googlelogin.au3 (8) : ==> The requested action with this object has failed.: $oIE.document.getElementByName("Passwd").value=$password $oIE.document.getElementByName("Passwd")^ ERROR >Exit code: 1 Time: 15.042 and $oIE.document.getElementByName("Passwd").value=$password ; Input pass didnt work. is this a bug ? Please help me. Link to comment Share on other sites More sharing options...
DaleHohm Posted February 13, 2012 Share Posted February 13, 2012 There is no DOM method getElementByName - it is getElementsByName and it returns a collection, so you need to specify an item: $username = InputBox("Message","Type Acc") $password = InputBox("Message","Type Pass") $oIE = ObjCreate("InternetExplorer.Application") ; $oIE.visible = True ; show ie $oIE.Navigate("[url="https://accounts.google.com/ServiceLogin?hl=en&continue=http://www.google.com.vn/"]https://accounts.google.com/ServiceLogin?hl=en&continue=http://www.google.com.vn/[/url]") Sleep(10000) $oIE.document.getElementById("Email").value=$username ; input acc $oIE.document.getElementsByName("Passwd").Item(0).value=$password ; Input pass $oIE.document.getElementById("signIn").click ; click button Login Using the _IE functions from IE.au3 would likely simplify this for you. Dale phamhoangthi 1 Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
phamhoangthi Posted February 13, 2012 Author Share Posted February 13, 2012 But Some website have many names of Elements, so how to know where is my names of Elements that i need?I have tried to change value of Item (0) but it didn't workThis is one, http://community.mybb.com/member.php?action=loginI cannot login this getElementsByName("Passwd").Item(0).value=$password Link to comment Share on other sites More sharing options...
DaleHohm Posted February 13, 2012 Share Posted February 13, 2012 That's because the name of the elelment on that site is "password", not "Passwd". I don't think you have a very good understanding of what you are trying to do. Again, the _IE function will help you with examples and error handling. Please see the helpfile. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 13, 2012 Moderators Share Posted February 13, 2012 phamhoangthi,And also please read the Forum Rules - particularly the bit that says:"Do not discuss any of the following: [...] This includes forum or site auto-login methods". M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts