faustf Posted May 23, 2020 Share Posted May 23, 2020 hi guys some day ago i create a automatic login for my ebay account , it work good but today stopped to work , i think is problem with javascript or bho expandcollapse popup#include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <File.au3> #include <IE.au3> #include <Array.au3> #include <INet.au3> #include <Debug.au3> Global $iGTimeToCeckTruck = 1000, $iGTimeOutTruck = 1000, $oIE Global $sGUtente = "xxxxxxx", $sGUsereBayLogAcqu = "", $sGPasseBayLogAcqu = "" _Login_eBay() Func _Login_eBay() $sGUsereBayLogAcqu = "xxxxxxx" $sGPasseBayLogAcqu = "xxxxxxx" If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running. ProcessClose("iexplore.exe") EndIf ; $oIE = _IECreate("https://signin.ebay.it/ws/eBayISAPI.dll?SignIn&UsingSSL=1&pUserId=&co_partnerId=2&siteid=101&ru=https%3A%2F%2Fmy.ebay.it%2Fws%2FeBayISAPI.dll%3FMyEbayBeta%26MyEbay%3D%26gbh%3D1%26guest%3D1&pageType=3984", 0, 1, 1, 1) ; <--- 0011 invisible explorer <--- 0111 visible explorer $oIE = _IECreate("https://signin.ebay.it/ws/eBayISAPI.dll?SignIn&ru=https%3A%2F%2Fwww.ebay.it%2F", 0, 1, 1, 1) ; <--- 0011 invisible explorer <--- 0111 visible explorer _IELoadWait($oIE, $iGTimeToCeckTruck, $iGTimeOutTruck) $iLCtrlDelay = 0 Do Local $sLBodyHtl = _IEBodyReadHTML($oIE) If StringInStr($sLBodyHtl, "learnMoreLink") Then $iLCtrlDelay = 1 EndIf If StringInStr($sLBodyHtl, "Ciao") Then $iLCtrlDelay = 1 EndIf Until $iLCtrlDelay = 1 If StringInStr($sLBodyHtl, "Email o nome utente") Then Local $oLogin = _IEGetObjByName($oIE, "userid") _IEAction($oLogin, "focus") _IEAction($oLogin, "Click") ;_IEFormElementSetValue($oLogin, $CmdLine[1]) ; user _IEFormElementSetValue($oLogin, $sGUsereBayLogAcqu) ; user MsgBox(0,'','sono qui') Local $oBtns = $oIE.document.GetElementsByTagName("button") For $oBtn In $oBtns $id = String($oBtn.id()) ;ConsoleWrite($classname & @CRLF) If $id = "sgnBt" Then _IEAction($oBtn, "click") ; _IEFormElementSetValue($oBtn, $sUser) EndIf If $id = "signin-continue-btn" Then _IEAction($oBtn, "click") ; _IEFormElementSetValue($oBtn, $sUser) EndIf Next EndIf Sleep(5000) If StringInStr($sLBodyHtl, "password") Then Local $oPassword = _IEGetObjByName($oIE, "pass") _IEAction($oPassword, "focus") _IEAction($oPassword, "Click") ;_IEFormElementSetValue($oLogin, $CmdLine[1]) ; user _IEFormElementSetValue($oPassword, $sGPasseBayLogAcqu) ; user Local $oBtns = $oIE.document.GetElementsByTagName("button") For $oBtn In $oBtns $id = String($oBtn.id()) ;ConsoleWrite($classname & @CRLF) If $id = "sgnBt" Then _IEAction($oBtn, "click") ; _IEFormElementSetValue($oBtn, $sUser) EndIf If $id = "signin-continue-btn" Then _IEAction($oBtn, "click") ; _IEFormElementSetValue($oBtn, $sUser) EndIf Next EndIf endfunc anyone can help me ? thankz again Link to comment Share on other sites More sharing options...
orbs Posted May 23, 2020 Share Posted May 23, 2020 you may want to use eBay API instead of browser automation. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
faustf Posted May 23, 2020 Author Share Posted May 23, 2020 ebay api work only for seller , now implement api side buyer , but is not complete , i want list items bought ,for give in semi-automatic manner a feedback, (this is my scope ) , but for that , not exist api (that i know of) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 23, 2020 Moderators Share Posted May 23, 2020 @faustf you have been around long enough to know "doesn't work" doesn't help anyone help you. Think about the information you are putting into a post, and whether you would have enough to go on. WHAT errors are you seeing, or AT WHAT POINT is it failing, WHAT has changed on your system, WHEN did it last work as expected - these are all the most basic of questions you should include in a post for help. Danp2 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
faustf Posted May 23, 2020 Author Share Posted May 23, 2020 sorry (i suppose test my code ), so in practical write my password in textbox after push a button , but return me error like if i not insert nothing in text box Link to comment Share on other sites More sharing options...
argumentum Posted May 23, 2020 Share Posted May 23, 2020 1 hour ago, faustf said: sorry (i suppose test my code ) lol, now that is a funny sight 😜 Danp2 and TheDcoder 2 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
argumentum Posted May 23, 2020 Share Posted May 23, 2020 ..joke aside, ...if you wrote your code more ala UDF, it'll be easier to maintain, and eventually share ..not that I do eBay, but I think is a good idea to code it as such. FrancescoDiMuro 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
faustf Posted May 23, 2020 Author Share Posted May 23, 2020 yea if you want i can share but i think you are much better like programmer than me argumentum 1 Link to comment Share on other sites More sharing options...
argumentum Posted May 23, 2020 Share Posted May 23, 2020 (edited) ...I used to enjoy let my mind run, my fingers type, ...all in line, who needs functions !, ..this makes sense, all .... . After a while I learned to take my time, functionize as much as possible and magically became more proficient. I'm just a scripter, I could not make a DLL call if my life depended on it. I know that if you slow down ( your mind ) your code can be something beautiful, ... ppl would fall in love with it. Edit: Func _Login_eBay($sGUsereBayLogAcqu = "xxxxxxx", $sGPasseBayLogAcqu = "xxxxxxx") ... ... ...that type of coding. Edited May 23, 2020 by argumentum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
faustf Posted May 24, 2020 Author Share Posted May 24, 2020 yea but problem is not login because when the script push button not read what i typed before o_O Link to comment Share on other sites More sharing options...
Danp2 Posted May 24, 2020 Share Posted May 24, 2020 You need to trigger the element's "input" event. See code at below link for an example -- faustf 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
faustf Posted May 24, 2020 Author Share Posted May 24, 2020 @Danp2 thankz so much its work Link to comment Share on other sites More sharing options...
faustf Posted May 24, 2020 Author Share Posted May 24, 2020 @argumentum take a start at "UDF" aslo if i dont like do UDF with macro , i think is not much stable , i think if exist API will be better #include <IE.au3> $url = "https://signin.ebay.it/ws/eBayISAPI.dll?SignIn&UsingSSL=1&pUserId=&co_partnerId=2&siteid=101&ru=https%3A%2F%2Fmy.ebay.it%2Fws%2FeBayISAPI.dll%3FMyEbayBeta%26MyEbay%3D%26gbh%3D1%26guest%3D1&pageType=3984" $User = "XXXXXX" $Pass = "xxxxxx" _eBayLogin($url,$User,$Pass) Func _eBayLogin($sUrl,$sUser,$sPass) $oIE = _IECreate($sUrl, 0, 1, 1, 1) ; <--- 0011 invisible explorer <--- 0111 visible explorer $oDoc = _IEDocGetObj($oIE) $oEvt = $oDoc.createEvent("HTMLEvents") $oEvt.initEvent("input", True, False) Sleep(5000) $oUsername = _IEGetObjById($oIE,"userid") _IEFormElementSetValue($oUsername, $sUser) $oUsername.dispatchEvent($oEvt) Sleep(1000) $oButton = _IEGetObjById($oIE,"signin-continue-btn") _IEAction($oButton, "click") Sleep(5000) $oPassword = _IEGetObjById($oIE,"pass") _IEFormElementSetValue($oPassword, $sPass) $oPassword.dispatchEvent($oEvt) Sleep(1000) $oButton = _IEGetObjById($oIE,"sgnBt") _IEAction($oButton, "click") EndFunc argumentum 1 Link to comment Share on other sites More sharing options...
DING Posted July 2, 2020 Share Posted July 2, 2020 Is there any way to use it on chrome? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 2, 2020 Moderators Share Posted July 2, 2020 @DING since the code above is using the IE library, no you cannot just convert it to work on Chrome. If you use the forum's search function, however, you will find a myriad of other ways to accomplish this task with Chrome, such as the Chrome library, the IUIAutomation thread, or the WebDriver thread. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now