Jump to content

WebDriver UDF - Pop up some weird black box


Recommended Posts

Hi Guys, i just do some codding to automate login to some of the web.

I manage to do the script but somehow after script done, some weird box popup. and keep looping until i close the main chrome.exe

image.png.bf2cad03b8549c0ff90cbc53c4a9362c.png

here is my code. kinldy pls assist, im very new to webdriver udf.

#NoTrayIcon
#include "wd_core.au3"
#include "wd_helper.au3"

$_WD_DEBUG = $_WD_DEBUG_None ; You could also use $_WD_DEBUG_Error

Local $sDesiredCapabilities, $sSession
SetupChrome()

_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, "https://someoftheweb.com")
_ChromeSetInputValueByName($sSession, "inputName", "Username")
_ChromeSetInputValueById($sSession, "inputPassword", "Password")
_ChromeSetMouseClick($sSession, "submit", "click")
_WD_Shutdown()

Func SetupChrome()
    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')
    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--no-sandbox"]}}}}'
EndFunc 

Func _ChromeSetInputValueByName($sSession,$name,$Value)
    $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$name&"']")
    _WD_ElementAction($sSession,$sButton,'value', $Value)
EndFunc

Func _ChromeSetInputValueById($sSession,$Id,$Value)
    $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$Id&"']")
    _WD_ElementAction($sSession,$sButton,'value', $Value)
EndFunc

Func _ChromeSetMouseClick($sSession,$Id,$Value)
    $sButton = _WD_FindElement($sSession,$_WD_LOCATOR_ByXPath,"//button[@type='"&$Id&"']")
    _WD_ElementAction($sSession, $sButton, 'click', $Value)
EndFunc

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...