Jump to content

Search the Community

Showing results for tags 'chromedriver'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 3 results

  1. I have been trying to select a field in a page in order to insert a value. I have tried so many tings but am not able to find the elemet on the page. The element is there I can see it. once the page is loaded. I have tried Sleep for 10 seconds, Load wait and every suggestion chat GPt could offer. I have to mention that I have played with the files because I was getting errors in relation to function used in wd-core.au3 so I had to change some function names and all. It could be that me chrome driver is not in synch with the included file versions. As of now. I am getting the error ""Could not find the search button" #include "JSON.au3" #include "WinHttp.au3" #include "wd_core.au3" #include "wd_helper.au3" #include "wd_capabilities.au3" ; Setup ChromeDriver Global $_WD_DRIVER = "C:\Tools\ChromeDriver\chromedriver.exe" Global $_WD_PORT = 9515 Global $_WD_DRIVER_PARAMS = "--port=9515" ; Start WebDriver _WD_Startup() ; === Set Capabilities === Local $sCaps = '{"capabilities":{"alwaysMatch":{"browserName":"chrome","goog:chromeOptions":{"args":["--start-maximized"]}}}}' _WD_Option('Capabilities', $sCaps) ; Create Session Local $sSession = _WD_CreateSession() If @error Then MsgBox(16, "Error", "Failed to create session.") Exit EndIf ; Navigate to website _WD_Navigate($sSession, "https://distributionjjcandy.com/account/login") ;Local $sSource = _WD_GetSource($sSession) ;ConsoleWrite($sSource & @CRLF) ;_WD_LoadWait($sSession) ; wait for page to load Sleep(3000) Local $jsCode = "return (function() {" & _ "var el = document.querySelector('#input--template--22102333292843__main--customeremail');" & _ "if(el) {return (el.offsetWidth > 0 && el.offsetHeight > 0);} else {return false;}" & _ "})()" Local $result = _WD_ExecuteScript($sSession, $jsCode) ConsoleWrite("Visible? " & $result & @CRLF) ; Find and click the search button (by CSS selector) Local $sElement = _WD_FindElement($sSession, "xpath", "//input[@type='email']") ;Local $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByLinkText, "Login") ;_WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "a[href='/account/login']", 10000) ;_WD_ElementAction($sSession, $sElement, 'focus') _WD_SetElementValue($sSession, $sElement, "your@email.com") Sleep(1000) If StringStripWS($sElement, 3) = "" Or StringLower($sElement) = "null" Or StringInStr($sElement, "error") Then MsgBox(16, "Error", "Could not find the search button.") Else _WD_ElementAction($sSession, $sElement, 'click') EndIf ;Local $sJS = "document.querySelector(""a[href='/account/login']"").click();" ;Local $sResult = _WD_ExecuteScript($sSession, $sJS, "[]") ;ConsoleWrite("JavaScript click result: " & $sResult & @CRLF) Sleep(3000) ; Close everything ;_WD_DeleteSession($sSession) ;_WD_Shutdown() ConcoleOutput..A.txt JSON.au3 WinHttp.au3 wd_core.au3 wd_helper.au3 wd_capabilities.au3
  2. 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
  3. 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?
×
×
  • Create New...