Search the Community
Showing results for tags 'chromedriver'.
-
Hi, I have the below script. It should return the second screenshot, however sometimes I get the first screenshot. On some computers I almost 90% get screen 2, but on some others I get screen 1 (wrong screen) almost every time. I have played around with "_WD_LoadWait", sleep or using "_WD_WaitElement", however I do not seem to be able get the reason why my script is behaving so randomly. Does anyone have some insights for me ? #include "wd_helper.au3" #include "wd_capabilities.au3" _Example() Func _Example() # REMARK # This is not functional script # It only shows the concept how to use WebDriver UDF #Region ; initialize webdriver sesion _WD_UpdateDriver('chrome') ; specify driver, port and other options _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & @ScriptDir & '\chrome.log"') ; start the driver _WD_Startup() If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; create capabilites for session _WD_CapabilitiesStartup() _WD_CapabilitiesAdd('alwaysMatch', 'chrome') _WD_CapabilitiesAdd('w3c', True) _WD_CapabilitiesAdd('excludeSwitches', 'enable-automation') Local $sCapabilities = _WD_CapabilitiesGet() ; create session with given Capabilities Global $sSession = _WD_CreateSession($sCapabilities) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's _WD_Window($sSession, 'maximize') #EndRegion ; initialize webdriver sesion #Region ; do your's stuff ; navigate to some website Local $sURL = "https://ordermanager.tecalliance.net/newapp/auth/login" _WD_Navigate($sSession, $sURL) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; wait for loading process ends _WD_LoadWait($sSession, 1000) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; find cookie popup Local $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='mat-button-wrapper']") If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; click on default button from cookie popup (accept) _WD_ElementAction($sSession, $sElement, 'click') If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; wait max. 50 seconds for the login button (=aanmelden) to be available _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='mat-focus-indicator log-in-button mat-raised-button mat-button-base']", 100, 50 * 1000) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; find this login (=aanmelden) button $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='mat-focus-indicator log-in-button mat-raised-button mat-button-base']") If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; click this "login" button to start login process _WD_ElementAction($sSession, $sElement, 'click') If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; wait for the username (=gebruikersnaam) field to be available _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//input[@id="input28"]', 100, 30 * 1000) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; find this username field $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//input[@id="input28"]') If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; fill in user e-mail in the input field _WD_ElementAction($sSession, $sElement, 'value', "test@test.nl") If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; lookup orange [Volgende] (=next) button $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='button button-primary']") If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; click on the orange [volgende] (=next) button to continue _WD_ElementAction($sSession, $sElement, 'click') If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's Exit ; Exit so not to close his Chrome session. #EndRegion ; do your's stuff #Region ; Clean Up ; on the end session should be deleted _WD_DeleteSession($sSession) If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's ; and driver should be closed _WD_Shutdown() If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's #EndRegion ; Clean Up EndFunc ;==>_Example
- 12 replies
-
I have several webdriver "projects" using the Webdriver UDF. For these I specifically use Chromedriver. Recently I noticed people getting an onetime popup when using GoogleChrome to choose their default serach engine. Yesterdy, I just installed a new WIndows 11 machine and got the popup once when using Google Chrome for the first time, however when using webdriver/chromedriver I get the popup everytime I start a script. Older computers with Wndows 10 or WIndows 11 do not have the popup when running the same scripts! Does any one know a way do disable this within my chromedriver Autoit scripts?
- 2 replies
-
- search engine
- chromedriver
-
(and 3 more)
Tagged with: