Jump to content
Danp2

WebDriver UDF - Help & Support

Recommended Posts

 

While using chromedriver, I once encountered an error message. The error seemed to have occured in _WD_CreateSession command and as far as I remember the title of message box was 'WebDriver.au3 Error' and the text read something like 'send / receive error'. I tried to replicate the error in vain. I am worried that it might occur when it should not, such as when I am away.

Do you have any idea what could cause the error? How can I prevent it or how can I trap it?

Share this post


Link to post
Share on other sites

Thanks. If I suppress the message box will the session still be created despite the error?

Edited by CYCho

Share this post


Link to post
Share on other sites

Maybe I can do this and hope that the error won't show up again.

SetupChrome()
_WD_Startup()
$_WD_ERROR_MSGBOX = False
$timer = TimerInit()
While Not WinActive("data:, - Chrome")
    $Session = _WD_CreateSession($sDesiredCapabilities)
    Sleep(1000)
    While Not WinActive("data:, - Chrome")
        Sleep(100)
        If TimerDiff($timer) > 10000 Then
            $timer = TimerInit()
            ExitLoop
        EndIf
    WEnd
WEnd

 

Share this post


Link to post
Share on other sites

I'm having a bit of a problem with using chromedriver headlessly. The sites I'm trying to go to are having Mixed Content problems, and I can't get chromedriver to start in a way that doesn't grind everything to a halt when the Mixed Content happens.

Local $oChrome = _WD_CreateSession('{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args": ["--headless", "--allow-running-insecure-content"] }}}}')

Which then creates __WD_Posts like:

__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb)","userDataDir":"C:\\Users\\Intern\\AppData\\Local\\Temp\\scoped_dir16220_22809"},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Windows NT","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"66.0.3359.117","webStorageEnabled":true},"sessionId":"6d7fab266a0ca493d2f894c931ca620b"}}

 

Share this post


Link to post
Share on other sites

@Danp2 

#include <wd_core.au3>
#include <wd_helper.au3>

;####################
;Opening Chrome
;####################
Local $oId = _WD_Startup()
Local $oChrome = _WD_CreateSession('{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true}}}}');, "args": ["--headless", "--allow-running-insecure-content"] }}}}')

;Start navigating to the login page
_WD_Navigate($oChrome, 'https://www-01.ibm.com/software/passportadvantage/')

 

Share this post


Link to post
Share on other sites

@Danp2 It doesn't? I commented out the headless part of the code, so I can uncomment it real quick so it runs but fails. I also always use Aut2Exe for console writing.

#include <wd_core.au3>
#include <wd_helper.au3>

;####################
;Opening Chrome
;####################
Local $oId = _WD_Startup()
Local $oChrome = _WD_CreateSession('{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args": ["--headless", "--allow-running-insecure-content"] }}}}')

;Start navigating to the login page
_WD_Navigate($oChrome, 'https://www-01.ibm.com/software/passportadvantage/')

I also have the following as my Global Variables (which I should maybe put into the script with _WD_Option() rather than editing wd_core.au3 directly).

Global $_WD_DRIVER = "C:\PathTo\chromedriver_win32\chromedriver.exe" ; Path to web driver executable
Global $_WD_DRIVER_PARAMS = "" ; Parameters to pass to web driver executable
Global $_WD_BASE_URL = "HTTP://127.0.0.1"
Global $_WD_PORT = 9515 ; Port used for web driver communication
Global $_WD_OHTTP = ObjCreate("winhttp.winhttprequest.5.1")
Global $_WD_HTTPRESULT ; Result of last WinHTTP request

 

Edited by Redd500

Share this post


Link to post
Share on other sites

Okay, so I realized the errors were mostly from the cmd window and not Scite because I don't use Scite I use Notepad++.

#include <wd_core.au3>
#include <wd_helper.au3>

;####################
;Opening Chrome
;####################
_WD_Option("Driver", "C:\Users\Intern\Downloads\chromedriver_win32\chromedriver.exe")
_WD_Option("Port", 9515)
Local $oId = _WD_Startup()
Local $oChrome = _WD_CreateSession('{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args": ["--headless", "--allow-running-insecure-content"] }}}}')

;Start navigating to the login page
_WD_Navigate($oChrome, 'https://www-01.ibm.com/software/passportadvantage/')
_WD_LinkClickByText($oChrome, "Passport Advantage Online")
_WD_LinkClickByText($oChrome, "Passport Advantage for Business Partners")
_WD_LinkClickByText($oChrome, "Reseller sign in")

This runs 100% fine if I don't do it headlessly.

_WDStartup: OS: WIN_10 WIN32_NT 16299 
_WDStartup: AutoIt: 3.3.14.3
_WDStartup: WD.au3: 0.1.0.9
_WDStartup: Driver: C:\PathTo\chromedriver_win32\chromedriver.exe
_WDStartup: Params: 
_WDStartup: Port:   9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args": ["--headless", "--allow-running-insecure-content"] }}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb)","userDataDir":"C:\\Users\\Intern\\AppData\\Local\\Temp\\scoped_dir12052_12441"},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Windows NT","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"66.0.3359.117","webStorageEnabled":true},"sessionId":"a1fb3c4c09bc2f518c2f85665051efd0"}}
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb)","userDataDir":"C:\\Users\\Intern\\AppData\\Local\\Temp\\scoped_dir12052_12441"},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platform":"Windows NT","rotatable":false,"setWindowRect":true,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"66.0.3359.117","webStorageEnabled":true},"sessionId":"a1fb3c4c09bc2f518c2f85665051efd0"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/a1fb3c4c09bc2f518c2f85665051efd0/url; $sData={"url":"https://www-01.ibm.com/software/passportadvantage/"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_Navigate: {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/a1fb3c4c09bc2f518c2f85665051efd0/element; $sData={"using":"partial link text","value":"Passport Advantage Online"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"Unable to locate element{\"method\"\"partial link text\",\"selector\"\"Passport Advantage Online\"}(Session infoheadless chrome=66.0.3359.117)","stacktrace":"Backtrace:\n\t(No symbol) [0x00FCE8F0]\n\t(No symbol) [0x00FB7CCD]\n\t(No symbol) [0x00F86D73]\n\t(No symbol) [0x00F55A6E]\n\t(No symbol) [0x00F6F760]\n\t(No symbol) [0x00F66D60]\n\t(No symbol) [0x00F6E35B]\n\t(No symbol) [0x00F66CEB]\n\t(No symbol) [0x00F50D9E]\n\t(No symbol) [0x00F52314]\n\t(No symbol) [0x00F522BA]\n\t(No symbol) [0x00FF38D6]\n\t(No symbol) [0x00FD2AB3]\n\t(No symbol) [0x00FA08C6]\n\t(No symbol) [0x00FA0BF3]\n\t(No symbol) [0x00FA0D03]\n\t(No symbol) [0x00FD4B47]\n\t(No symbol) [0x00FA060F]\n\t(No symbol) [0x00FA177E]\n\t(No symbol) [0x00F9D59B]\n\t(No symbol) [0x00F9D6F5]\n\t(No symbol) [0x00FB000B]\n\tBaseThreadInitThunk [0x76AE8654+36]\n\tRtlGetAppContainerNamedObjectPath [0x77724B17+311]\n\tRtlGetAppContainerNamedObjectPath [0x77724AE7+263]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"Unable to locate element{\"method\"\"partial link text\",\"selector\"\"Passport Advantage Online\"}(Session infoheadless chrome=66.0.3359.117)","stacktrace":"Backtrace:\n\t(No symbol) [0x00FCE8F0]\n\t(No symbol) [0x00FB7CCD]\n\t(No symbol) [0x00F86D73]\n\t(No symbol) [0x00F55A6E]\n\t(No symbol) [0x00F6F760]\n\t(No symbol) [0x00F66D60]\n\t(No symbol) [0x00F6E35B]\n\t(No symbol) [0x00F66CEB]\n\t(No symbol) [0x00F50D9E]\n\t(No symbol) [0x00F52314]\n\t(No symbol) [0x00F522BA]\n\t(No symbol) [0x00FF38D6]\n\t(No symbol) [0x00FD2AB3]\n\t(No symbol) [0x00FA08C6]\n\t(No symbol) [0x00FA0BF3]\n\t(No symbol) [0x00FA0D03]\n\t(No symbol) [0x00FD4B47]\n\t(No symbol) [0x00FA060F]\n\t(No symbol) [0x00FA177E]\n\t(No symbol) [0x00F9D59B]\n\t(No symbol) [0x00F9D6F5]\n\t(No symbol) [0x00FB000B]\n\tBaseThreadInitThunk [0x76AE8654+36]\n\tRtlGetAppContainerNamedObjectPath [0x77724B17+311]\n\tRtlGetAppContainerNamedObjectPath [0x77724AE7+263]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
_WD_LinkClickByText ==> No match
__WD_Post: URL=HTTP://127.0.0.1:9515/session/a1fb3c4c09bc2f518c2f85665051efd0/element; $sData={"using":"partial link text","value":"Passport Advantage for Business Partners"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"Unable to locate element{\"method\"\"partial link text\",\"selector\"\"Passport Advantage for Business Partners\"}(Session infoheadless chrome=66.0.3359.117)","stacktrace":"Backtrace:\n\t(No symbol) [0x00FCE8F0]\n\t(No symbol) [0x00FB7CCD]\n\t(No symbol) [0x00F86D73]\n\t(No symbol) [0x00F55A6E]\n\t(No symbol) [0x00F6F760]\n\t(No symbol) [0x00F66D60]\n\t(No symbol) [0x00F6E35B]\n\t(No symbol) [0x00F66CEB]\n\t(No symbol) [0x00F50D9E]\n\t(No symbol) [0x00F52314]\n\t(No symbol) [0x00F522BA]\n\t(No symbol) [0x00FF38D6]\n\t(No symbol) [0x00FD2AB3]\n\t(No symbol) [0x00FA08C6]\n\t(No symbol) [0x00FA0BF3]\n\t(No symbol) [0x00FA0D03]\n\t(No symbol) [0x00FD4B47]\n\t(No symbol) [0x00FA060F]\n\t(No symbol) [0x00FA177E]\n\t(No symbol) [0x00F9D59B]\n\t(No symbol) [0x00F9D6F5]\n\t(No symbol) [0x00FB000B]\n\tBaseThreadInitThunk [0x76AE8654+36]\n\tRtlGetAppContainerNamedObjectPath [0x77724B17+311]\n\tRtlGetAppContainerNamedObjectPath [0x77724AE7+263]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"Unable to locate element{\"method\"\"partial link text\",\"selector\"\"Passport Advantage for Business Partners\"}(Session infoheadless chrome=66.0.3359.117)","stacktrace":"Backtrace:\n\t(No symbol) [0x00FCE8F0]\n\t(No symbol) [0x00FB7CCD]\n\t(No symbol) [0x00F86D73]\n\t(No symbol) [0x00F55A6E]\n\t(No symbol) [0x00F6F760]\n\t(No symbol) [0x00F66D60]\n\t(No symbol) [0x00F6E35B]\n\t(No symbol) [0x00F66CEB]\n\t(No symbol) [0x00F50D9E]\n\t(No symbol) [0x00F52314]\n\t(No symbol) [0x00F522BA]\n\t(No symbol) [0x00FF38D6]\n\t(No symbol) [0x00FD2AB3]\n\t(No symbol) [0x00FA08C6]\n\t(No symbol) [0x00FA0BF3]\n\t(No symbol) [0x00FA0D03]\n\t(No symbol) [0x00FD4B47]\n\t(No symbol) [0x00FA060F]\n\t(No symbol) [0x00FA177E]\n\t(No symbol) [0x00F9D59B]\n\t(No symbol) [0x00F9D6F5]\n\t(No symbol) [0x00FB000B]\n\tBaseThreadInitThunk [0x76AE8654+36]\n\tRtlGetAppContainerNamedObjectPath [0x77724B17+311]\n\tRtlGetAppContainerNamedObjectPath [0x77724AE7+263]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
_WD_LinkClickByText ==> No match
__WD_Post: URL=HTTP://127.0.0.1:9515/session/a1fb3c4c09bc2f518c2f85665051efd0/element; $sData={"using":"partial link text","value":"Reseller sign in"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"Unable to locate element{\"method\"\"partial link text\",\"selector\"\"Reseller sign in\"}(Session infoheadless chrome=66.0.3359.117)","stacktrace":"Backtrace:\n\t(No symbol) [0x00FCE8F0]\n\t(No symbol) [0x00FB7CCD]\n\t(No symbol) [0x00F86D73]\n\t(No symbol) [0x00F55A6E]\n\t(No symbol) [0x00F6F760]\n\t(No symbol) [0x00F66D60]\n\t(No symbol) [0x00F6E35B]\n\t(No symbol) [0x00F66CEB]\n\t(No symbol) [0x00F50D9E]\n\t(No symbol) [0x00F52314]\n\t(No symbol) [0x00F522BA]\n\t(No symbol) [0x00FF38D6]\n\t(No symbol) [0x00FD2AB3]\n\t(No symbol) [0x00FA08C6]\n\t(No symbol) [0x00FA0BF3]\n\t(No symbol) [0x00FA0D03]\n\t(No symbol) [0x00FD4B47]\n\t(No symbol) [0x00FA060F]\n\t(No symbol) [0x00FA177E]\n\t(No symbol) [0x00F9D59B]\n\t(No symbol) [0x00F9D6F5]\n\t(No symbol) [0x00FB000B]\n\tBaseThreadInitThunk [0x76AE8654+36]\n\tRtlGetAppContainerNamedObjectPath [0x77724B17+311]\n\tRtlGetAppContainerNamedObjectPath [0x77724AE7+263]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"Unable to locate element{\"method\"\"partial link text\",\"selector\"\"Reseller sign in\"}(Session infoheadless chrome=66.0.3359.117)","stacktrace":"Backtrace:\n\t(No symbol) [0x00FCE8F0]\n\t(No symbol) [0x00FB7CCD]\n\t(No symbol) [0x00F86D73]\n\t(No symbol) [0x00F55A6E]\n\t(No symbol) [0x00F6F760]\n\t(No symbol) [0x00F66D60]\n\t(No symbol) [0x00F6E35B]\n\t(No symbol) [0x00F66CEB]\n\t(No symbol) [0x00F50D9E]\n\t(No symbol) [0x00F52314]\n\t(No symbol) [0x00F522BA]\n\t(No symbol) [0x00FF38D6]\n\t(No symbol) [0x00FD2AB3]\n\t(No symbol) [0x00FA08C6]\n\t(No symbol) [0x00FA0BF3]\n\t(No symbol) [0x00FA0D03]\n\t(No symbol) [0x00FD4B47]\n\t(No symbol) [0x00FA060F]\n\t(No symbol) [0x00FA177E]\n\t(No symbol) [0x00F9D59B]\n\t(No symbol) [0x00F9D6F5]\n\t(No symbol) [0x00FB000B]\n\tBaseThreadInitThunk [0x76AE8654+36]\n\tRtlGetAppContainerNamedObjectPath [0x77724B17+311]\n\tRtlGetAppContainerNamedObjectPath [0x77724AE7+263]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
_WD_LinkClickByText ==> No match
>Exit code: 0    Time: 7.552

In the cmd window, I get:

Starting ChromeDriver 2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb) on port 9515
Only local connections are allowed.
[0430/174035.091:ERROR:gpu_process_transport_factory.cc(1007)] Lost UI shared context.

DevTools listening on ws://127.0.0.1:12423/devtools/browser/6c85843e-d682-460f-811f-ad5f11c18883
[0430/174037.348:INFO:CONSOLE(2)] "Uncaught ReferenceError: dojo is not defined", source: https://www-01.ibm.com/software/main/js/swg-global.js (2)
[0430/174037.377:INFO:CONSOLE(0)] "Mixed Content: The page at 'https://www-01.ibm.com/software/passportadvantage/' was loaded over HTTPS, but requested an insecure script 'http://www.ibm.com/software/passportadvantage/fix_translate.js'. This request has been blocked; the content must be served over HTTPS.", source: https://www-01.ibm.com/software/passportadvantage/ (0)
[0430/174037.620:INFO:CONSOLE(0)] "The SSL certificate used to load resources from https://idaas.iam.ibm.com will be distrusted in the future. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information.", source: https://www-01.ibm.com/software/passportadvantage/ (0)
[0430/174038.812:INFO:CONSOLE(0)] "The SSL certificate used to load resources from https://aa.agkn.com will be distrusted in the future. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information.", source: https://bcp.crwdcntrl.net/5/ct=y/c=10026/rand=800688350/pv=y/tp=IBMX/seg=IBMID%3ANo/seg=%23OpR%2383593%23digitalData%20%3A%20user%20%3A%20userInfo%20%3A%20registry_country_code%20%3A%20us/int=%23OpR%2377304%23digitalData%20%3A%20siteID%20%3A%20IBM_GlobalMarketing/int=%23OpR%2378616%23Site%20Visitor%20%3A%20IBM.com/int=%23OpR%2378749%23digitalData%20%3A%20bomboraTopics%20%3A%20Analytics%20Software/int=%23OpR%2378784%23digitalData%20%3A%20bomboraTopics%20%3A%20Security%20Solutions/int=%23OpR%2378785%23digitalData%20%3A%20bomboraTopics%20%3A%20Software%20Licensing/int=%23OpR%2378786%23digitalData%20%3A%20bomboraTopics%20%3A%20Software%20Requirements/int=%23OpR%2378787%23digitalData%20%3A%20bomboraTopics%20%3A%20Software%20as%20a%20Service%20(SaaS)/int=%23OpR%2380062%23IBM%20-%20All%20URL%20Visitors/int=%23OpR%2383413%23digitalData%20%3A%20nluKeywords%20%3A%20Help%20desk/dem=%23OpR%2377294%23digitalData%20%3A%20isIBMer%20%3A%200/dem=%23OpR%2377836%23digitalData%20%3A%20language%20%3A%20en-US/genp=%23OpR%2377458%23digitalData%20%3A%20gbt10%20%3A%20G0000/genp=%23OpR%2377460%23digitalData%20%3A%20gbt17%20%3A%20G17PA/ug=%23OpR%2378009%23https%3A%2F%2Fwww-01.ibm.com%2Fsoftware%2Fpassportadvantage%2F/ug=%23OpR%2381952%23https%3A%2F%2Fwww-01/rt=ifr (0)
[0430/174042.811:INFO:CONSOLE(0)] "The SSL certificate used to load resources from https://uipglob.semasio.net will be distrusted in the future. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information.", source: https://pixel.mathtag.com/sync/iframe?mt_uuid=75e75ae7-85b3-4100-ba99-459642dd3316&no_iframe=1&mt_adid=171815&mt_lim=15 (0)

 

Share this post


Link to post
Share on other sites

Okay, so I'm guessing I should attempt Firefox next? IE doesn't work the way I need it to in headless, either, so I'm just going to attempt Firefox.

Share this post


Link to post
Share on other sites

I have a simple code to login to a web page. If I enter a wrong password the website shows an alert message, but the ChromeDriver seems unable to detect the alert. _WD_Alert($session, 'status') shows True but _WD_Alert($session, 'gettext') shows nothing. Please let me know where I'm doing not right.

#include "wd_core.au3"

Local $center = @DesktopWidth/2
Local $url = "http://www.acegolf.com/member/login.php?next_url=%2Fclub%2Fboard%2Fwrite.php%3Fpage%3D%26cb_id%3D353%26gsn%3D3464%26q%3D%26flag%3D"
Local $sDesiredCapabilities
SetupChrome()
_WD_Startup()
$Session = _WD_CreateSession($sDesiredCapabilities)
Sleep(2000)
_WD_Navigate($Session, $url)

Dim $xy = 0
While Not IsArray($xy)
    $xy = PixelSearch($center-260, 0, $center-260, @DesktopHeight, Dec("DFEFC0"))
    Sleep(100)
WEnd

$id = "cycho"
$pass = "12345" ; This is a wrong password

MouseClick("left", $xy[0], $xy[1]+10)
Sleep(200)
Send($id)
Sleep(200)
Send("{TAB}")
Sleep(200)
Send($pass)
Sleep(200)
Send("{ENTER}")
Sleep(2000)

MsgBox(0, '', _WD_Alert($Session, 'gettext'))

_WD_Shutdown()


Func SetupChrome()
    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--log-path=' & @ScriptDir & '\chrome.log')

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":["start-maximized", "disable-infobars"] }}}}'
EndFunc

 

Edited by CYCho

Share this post


Link to post
Share on other sites

@CYCho This appears to be an issue with ChromeDriver. When I ran your code in Scite, I received the following results in the Output panel --

__WD_Get: URL=HTTP://127.0.0.1:9515/session/521c93e3fcf3bdb8486c2a6b25425620/alert/text
__WD_Get: StatusCode=500; $sResponseText={"value":{"error":"unexpected alert open","message":"(Session infochrome=66.0.3359.139)","stacktrace":"Backtrace:\n\t(No symbol) [0x0099E8F0]\n\t(No symbol) [0x00987CCD]\n\t(No symbol) [0x00956B11]\n\t(No symbol) [0x0094CCD6]\n\t(No symbol) [0x0094CFC9]\n\t(No symbol) [0x0094CF88]\n\t(No symbol) [0x00955502]\n\t(No symbol) [0x0094D9A2]\n\t(No symbol) [0x0094DD9D]\n\t(No symbol) [0x0094DBEA]\n\t(No symbol) [0x0094D701]\n\t(No symbol) [0x0094D25F]\n\t(No symbol) [0x0094D19F]\n\t(No symbol) [0x009578D0]\n\t(No symbol) [0x009138EE]\n\t(No symbol) [0x00936CEB]\n\t(No symbol) [0x00920D9E]\n\t(No symbol) [0x00922314]\n\t(No symbol) [0x009222BA]\n\t(No symbol) [0x009C38D6]\n\t(No symbol) [0x009A2AB3]\n\t(No symbol) [0x009708C6]\n\t(No symbol) [0x00970BF3]\n\t(No symbol) [0x00970D03]\n\t(No symbol) [0x009A4B47]\n\t(No symbol) [0x0097060F]\n\t(No symbol) [0x0097177E]\n\t(No symbol) [0x0096D59B]\n\t(No symbol) [0x0096D6F5]\n\t(No symbol) [0x0098000B]\n\tBaseThreadInitThunk [0x76CD8484+36]\n\tRtlValidSecurityDescriptor [0x771D2EC0+448]\n\tRtlValidSecurityDescriptor [0x771D2E90+400]\n"}}

This is a stacktrace of the error occurring within the webdriver itself. The code ran as expected when adjusted to use Firefox instead of Chrome.

P.S. Is there a reason you are using PixelSearch, MouseClick, and Send instead of the available commands in the Webdriver UDF?

Share this post


Link to post
Share on other sites

@Danp2 Thank you. I have no experience with FireFox. Maybe I should try it.

PixelSearch, MouseClick, and Send are the functions I am used to for a long time. I didn't care to learn anything else. And you know I am very new to webdriver. What are webdriver alternatives that are better and I should learn?

Edited by CYCho

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Similar Content

    • By Danp2
      Introduction
      This UDF will allow you to interact with any browser that supports the W3C WebDriver specifications. Supporting multiple browsers via the same code base is now possible with just a few configuration settings.
      Requirements
      JSON UDF https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn
      WinHTTP UDF https://www.autoitscript.com/forum/topic/84133-winhttp-functions/
      WebDriver for desired browser
      Chrome WebDriver https://sites.google.com/a/chromium.org/chromedriver/downloads FireFox WebDriver https://github.com/mozilla/geckodriver/releases Edge WebDriver https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ Function List
      Core Functions
      _WD_CreateSession($sDesiredCapabilities='{}') _WD_DeleteSession($sSession) _WD_Status() _WD_Timeouts($sSession, $sTimeouts = '') _WD_Navigate($sSession, $sURL) _WD_Action($sSession, $sCommand) _WD_Window($sSession, $sCommand, $sOption = '') _WD_FindElement($sSession, $sStrategy, $sSelector, $sStartElement = "", $lMultiple = False) _WD_ElementAction($sSession, $sElement, $sCommand, $sOption='') _WD_ExecuteScript($sSession, $sScript, $sArguments="[]") _WD_Alert($sSession, $sCommand, $sOption = '') _WD_GetSource($sSession) _WD_Cookies($sSession, $sCommand, $sOption = '') _WD_Option($sOption, $vValue = "") _WD_Startup() _WD_Shutdown() Helper Functions
      _WD_NewTab($sSession, $lSwitch = True, $iTimeout = -1, $sURL = "", $sFeatures = "") _WD_Attach($sSession, $sString, $sMode = 'title') _WD_LinkClickByText($sSession, $sText, $lPartial = True) _WD_WaitElement($sSession, $sElement, $sStrategy, $sSelector[, $iDelay = 0[, $iTimeout = -1]]) _WD_GetMouseElement($sSession) _WD_GetElementFromPoint($sSession, $iX, $iY) _WD_LastHTTPResult() _WD_GetFrameCount() _WD_IsWindowTop() _WD_FrameEnter($sIndexOrID) _WD_FrameLeave() _WD_HighlightElement($sSession, $sElement[, $iMethod = 1]) _WD_HighlightElements($sSession, $aElements[, $iMethod = 1]) _WD_jQuerify($sSession) WD_ElementOptionSelect($sSession, $sStrategy, $sSelector, $sStartElement = "") _WD_ConsoleVisible($lVisible = False) _WD_Screenshot($sSession, $sElement = '', $nOutputType = 1) Source Code
      You will always be able to find the latest version in the GitHub Repo 
      Help / Support
      Please post any questions, suggestions or errors in the GH&S thread.
      https://www.autoitscript.com/forum/topic/192730-webdriver-udf-help-support/
    • By Davidowicza
      Hey guys,
      I am creating my very first script that automates a browser (I usually work with program installs and database automation) and have come across an issue that I am totally stumped on. I need to click an element that gives me a drop down list box but the Xpath to the element changes with every instance of chrome I start...
      I have tried selecting the class, rect, and path but no luck. It never finds the element. (I could be doing this wrong since I am not good at HTML)
      Element I need to select:
      This is the Xpath for the last 3 instances of chrome I have run the script with:
      //*[@id="highcharts-5bp9crq-8"]/svg/g[6]/g/rect //*[@id="highcharts-fiw9szv-8"]/svg/g[6]/g/rect //*[@id="highcharts-5szkmx8-8"]/svg/g[6]/g/rect As you can see the path changes every time.
      How I am trying to select the element:
      ;Check for box element _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='highcharts-5bp9crq-8']/svg/g[6]/g") MsgBox(0, "", "check for timeout") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='highcharts-5bp9crq-8']/svg/g[6]/g") _WD_ElementAction($sSession, $sElement, 'click') Maybe someone has come across this before and found a work around without using mouseclick()
      Thanks guys, hopefully I am just very overlooking something simple and can be pointed to the right solution.
      Side Note: I wish I could share the webpage entirety, but it has sensitive information with my agency that I cannot share. If you need more, just let me know and I will try and post as much as I can.
    • By daluu
      This is kind of already posted here:
      '?do=embed' frameborder='0' data-embedContent>>
      but wanted to note this in this forum of example scripts in case some people only look in this forum for examples and not the other forums with respect to AutoIt integration or relation to Selenium WebDriver.
      So, the example in summary is: you can use Selenium WebDriver API to do AutoIt GUI automation (the ControlXyz() and WinXyz() functons, along with mouse and "send keys" functions). Although I suppose that might be opposite or counter to what most examples here are about - using AutoIt to do or control other stuff rather than using other stuff to control/run AutoIt. But regardless, it is an example implementation of a different use case for AutoIt beyond the general AutoIt community, like those who also use Selenium WebDriver and/or need to integrate Selenium with AutoIt for remote deployment.
      https://github.com/daluu/AutoItDriverServer
      with specific demo examples here:
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/CalculatorTest.java
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/calculator.py
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/SeleniumIntegrationTest.java
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/SeleniumIntegrationWithAutoItDriver.py
×
×
  • Create New...