JonasSa Posted November 17, 2022 Share Posted November 17, 2022 (edited) Good evening, I have a problem using my script in chrome to open a certain website. Returns me some popup and chrome has a white window can you help me? Script : expandcollapse popup#include ".\bibliotecas\wd_core.au3" #include ".\bibliotecas\wd_helper.au3" $site = "https:\\exemple.com/" $user = $CmdLine[1] $password = $CmdLine[2] Func SetupChrome() _WD_Option('Driver', 'C:/Remote/Chrome/chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.Log') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "binary":"C:/Remote/Chrome/chrome.exe", "args":["--start-maximized --ignore-certificate-errors"]}}}}' EndFunc Local $sDesiredCapabilities, $sSession SetupChrome() ; _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, $site) Sleep(500) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='username']") _WD_ElementAction($sSession, $sElement, 'value', $user) Sleep(600) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='password']") If @error = $_WD_ERROR_NoMatch Then MsgBox(0, "Erro", "ID ou Name do campo password nao encontrado.") EndIf _WD_ElementAction($sSession, $sElement, 'value', $password) Sleep(500) Send("{ENTER}") Sleep(500) _WD_Shutdown() Edited November 18, 2022 by Jos Please Copy&Paste without formatting the next time! ... and a codebox for the script. Link to comment Share on other sites More sharing options...
Danp2 Posted November 18, 2022 Share Posted November 18, 2022 Welcome to the forum! It's difficult to know what isn't working correctly since we can't run your script. Is the "popup" you mentioned the Chromedriver console or something else? Can you show us the full contents of the Scite output panel? P.S. See the following link for the proper way to post code Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
JonasSa Posted November 18, 2022 Author Share Posted November 18, 2022 expandcollapse popup#include ".\bibliotecas\wd_core.au3" #include ".\bibliotecas\wd_helper.au3" $site = "https:\\exemple.com/" $usuário = $CmdLine[1] $senha = $CmdLine[2] Func SetupChrome() _WD_Option('Driver', 'C:/Remote/Chrome/chromedriver.exe') _WD_Option('Porta', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.Log') $sDesiredCapabilities = '{"capacities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "binary":"C:/Remote/Chrome/chrome.exe ", "args":["--start-maximized --ignore-certificate-errors"]}}}}' EndFunc Local $sDesiredCapabilities, $sSession SetupChrome() ; _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, $site) Sleep(500) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='username']") _WD_ElementAction( $sSession, $sElement, 'value', $user) Sleep(600) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='password']") If @error = $_WD_ERROR_NoMatch Then MsgBox(0, "Erro", "ID ou Name do campo password não encontrado. ") EndIf _WD_ElementAction($sSession, $sElement, 'value', $password) Sleep(500) Send("{ENTER}") Sleep(500) _WD_Shutdown() That's it, it's formatted correctly (Thanks) Attached, the images with the errors that occur when running the script Link to comment Share on other sites More sharing options...
JonasSa Posted November 18, 2022 Author Share Posted November 18, 2022 I tried with this script too expandcollapse popup#include ".\bibliotecas\wd_core.au3" #include ".\bibliotecas\wd_helper.au3" $site = "https:\\exemple.com" $user = $CmdLine[1] $password = $CmdLine[2] Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, $site) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='username']") _WD_ElementAction($sSession, $sElement, 'value', $user) Sleep(600) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='password']") If @error = $_WD_ERROR_NoMatch Then MsgBox(0, "Erro", "ID ou Name do campo password nao encontrado.") EndIf _WD_ElementAction($sSession, $sElement, 'value', $password) Sleep(500) Send("{ENTER}") Sleep(500) Func SetupChrome() _WD_Option('Driver', 'C:/Remote/Chrome/chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.Log') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "binary":"C:/Remote/Chrome/chrome.exe", "args":["--start-maximized --ignore-certificate-errors"]}}}}' EndFunc _WD_Shutdown() Link to comment Share on other sites More sharing options...
Danp2 Posted November 18, 2022 Share Posted November 18, 2022 You didn't post the Scite output panel contents, but I suspect that you are running an older copy of the UDF because that Alert window no longer appears by default. Please update to the latest version and then retest. Latest Webdriver UDF Release Webdriver Wiki FAQs 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