Jump to content
Danp2

WebDriver UDF - Help & Support

Recommended Posts

@TheDcoder I tested the following at it worked fine with both Chrome and Firefox --

_WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, '[href="/demo/line-basic"]')

FWIW, I recently made some changes to _WD_FindElement so that it escapes the double quote characters. I suspect that this will solve the issue you encountered, but can't be sure since you didn't provide enough details for me to know for sure. ūüėČ

Share this post


Link to post
Share on other sites
21 hours ago, Hamburgo said:

_WD_Window give back a simple string instead DictionaryObjekt

FYI, I've modified _WD_Window so that it will return the Dictionary object instead of the JSON string. This change will be included in the next release (0.1.0.19).

Share this post


Link to post
Share on other sites
12 hours ago, Danp2 said:

FWIW, I recently made some changes to _WD_FindElement so that it escapes the double quote characters. I suspect that this will solve the issue you encountered, but can't be sure since you didn't provide enough details for me to know for sure. ūüėČ

That might be the issue, I am using your latest release (not the master branch) from GitHub: https://github.com/Danp2/WebDriver/releases/tag/0.1.0.18.1

If _WD_FindElement in that version doesn't escape the double quoted characters then it is safe to say that it was the issue.


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ‚ÄĘ ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites
On 5/12/2019 at 11:35 PM, Danp2 said:

@TheDcoder I tested the following at it worked fine with both Chrome and Firefox --

FWIW, I recently made some changes to _WD_FindElement so that it escapes the double quote characters

More thanks to Danp2 for hard and meticulous work.....:thumbsup:

Spoiler

 

 

Share this post


Link to post
Share on other sites
Quote

     _WDStartup: OS:WIN_7 WIN32_NT 7601 Service Pack 1
    _WDStartup: AutoIt:3.3.14.2
    _WDStartup: WD.au3:0.1.0.19
    _WDStartup: Driver:chromedriver.exe
    _WDStartup: Params:--log-path="D:\MESS\Au3_Selenium\WebDriver-0.1.0.18\Login\chrome.log"
    _WDStartup: Port:9515

  __WD_Post: URL=HTTP://127.0.0.1:9515/session/1b53a582bd03134411a040e63da47c0d/element; $sData={"using":"xpath","value":"//*[@id=\"elUserSignIn_internal\"]/div/ul/li[1]/input"}

    __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"425a569a-48ed-4b43-98b5-40c9800cb06c"}}

    _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"425a569a-48ed-4b43-98b5-40c9800cb06c"}}

  __WD_Post: URL=HTTP://127.0.0.1:9515/session/1b53a582bd03134411a040e63da47c0d/element/425a569a-48ed-4b43-98b5-40c9800cb06c/value; $sData={"id":"425a569a-48ed-4b43-98b5-40c9800cb06c", "text":"username123"}

  __WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=74.0.3729.131)","stacktrace":"Backtrace:\n\t(No symbol) [0x0130E8F0]\n\t(No symbol) [0x012F7CCD]\n\t(No symbol) [0x012C6D73]\n\t(No symbol) [0x01293753]\n\t(No symbol) [0x012A6C8D]\n\t(No symbol) [0x01292808]\n\t(No symbol) [0x012A6E81]\n\t(No symbol) [0x012AE35B]\n\t(No symbol) [0x012A6CEB]\n\t(No symbol) [0x01290D9E]\n\t(No symbol) [0x01292314]\n\t(No symbol) [0x012922BA]\n\t(No symbol) [0x013338D6]\n\t(No symbol) [0x01312AB3]\n\t(No symbol) [0x012E08C6]\n\t(No symbol) [0x012E0BF3]\n\t(No symbol) [0x012E0D03]\n\t(No symbol) [0x01314B47]\n\t(No symbol) [0x012E060F]\n\t(No symbol) [0x012E177E]\n\t(No symbol) [0x012DD59B]\n\t(No symbol) [0x012DD6F5]\n\t(No symbol) [0x012F000B]\n\tBaseThreadInitThunk [0x771CED6C+18]\n\tRtlInitializeExceptionChain [0x77AB37EB+239]\n\tRtlInitializeExceptionChain [0x77AB37BE+194]\n"}}

  _WD_ElementAction: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=74.0.3729.131...

    _WD_ElementAction ==> Webdriver Exception: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=74.0.3729.131)","stacktrace":"Backtrace:\n\t(No symbol) [0x0130E8F0]\n\t(No symbol) [0x012F7CCD]\n\t(No symbol) [0x012C6D73]\n\t(No symbol) [0x01293753]\n\t(No symbol) [0x012A6C8D]\n\t(No symbol) [0x01292808]\n\t(No symbol) [0x012A6E81]\n\t(No symbol) [0x012AE35B]\n\t(No symbol) [0x012A6CEB]\n\t(No symbol) [0x01290D9E]\n\t(No symbol) [0x01292314]\n\t(No symbol) [0x012922BA]\n\t(No symbol) [0x013338D6]\n\t(No symbol) [0x01312AB3]\n\t(No symbol) [0x012E08C6]\n\t(No symbol) [0x012E0BF3]\n\t(No symbol) [0x012E0D03]\n\t(No symbol) [0x01314B47]\n\t(No symbol) [0x012E060F]\n\t(No symbol) [0x012E177E]\n\t(No symbol) [0x012DD59B]\n\t(No symbol) [0x012DD6F5]\n\t(No symbol) [0x012F000B]\n\tBaseThreadInitThunk [0x771CED6C+18]\n\tRtlInitializeExceptionChain [0x77AB37EB+239]\n\tRtlInitializeExceptionChain [0x77AB37BE+194]\n"}}

The same Xpath, works smoothly with Firefox; But using Chrome is not normal.The above is in chrome.

The test code is as follows:

#include "wd_core.au3"
#include "wd_helper.au3"
Local $url1 = "https://www.autoitscript.com/forum/"

Local $sDesiredCapabilities
SetupChrome();_setupFirefox()
_WD_Startup()
Local $Session=_WD_CreateSession($sDesiredCapabilities)
Sleep(1000)
_WD_Navigate($Session, $url1)
Sleep(1000)

local $sSign_in=_WD_FindElement($Session, $_WD_LOCATOR_ByPartialLinkText,'Sign In')
_WD_ElementAction($Session,$sSign_in, 'click')
Sleep(500)

;Starting with the following code, there is no response and seems to remain on the original web page
local $uElement = _WD_FindElement($Session, $_WD_LOCATOR_ByXPath, '//*[@id="elUserSignIn_internal"]/div/ul/li[1]/input')
_WD_ElementAction($Session, $uElement, 'value', "username123")
Sleep(500)
local $pElement = _WD_FindElement($Session, $_WD_LOCATOR_ByXPath, '//*[@id="elUserSignIn_internal"]/div/ul/li[2]/input')
_WD_ElementAction($Session, $pElement, 'value', "Password321")
Sleep(500)

local $sElement = _WD_FindElement($Session, $_WD_LOCATOR_ByXPath, '//*[@id="elSignIn_submit"]')
_WD_ElementAction($Session, $sElement, 'click')

func _setupFirefox()
    $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
    _WD_Option('Driver', 'geckodriver.exe')
    _WD_Option('DriverParams', '--log trace')
    _WD_Option('Port', 4444)
EndFunc
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 }}}}'
EndFunc

 

Edited by Letraindusoir

Share this post


Link to post
Share on other sites
5 hours ago, Danp2 said:

This worked fine for me with both Firefox and Chrome. What version of Chrome / Chromedriver are you using?

chrome=74.0.3729.131

chromedriver=2.38.552522

Is the chromedriver version inappropriate? But why can it run most of the processes, in which clicking the link and login buttons is still valid....

 

Edited by Letraindusoir

Share this post


Link to post
Share on other sites
1 minute ago, Letraindusoir said:

chrome=74.0.3729.131

chromedriver=2.38.552522

Is the chromedriver version inappropriate?

It seems that it is indeed the case: https://sites.google.com/a/chromium.org/chromedriver/downloads

Quote

Current Releases

The ChromeDriver's version matches the version of Chrome for which it is compatible with, so grab the same version of the driver as chrome.


A cross-platform implementation of the AutoIt language

My contributions to the AutoIt Community ‚ÄĘ ##AutoIt at freenode, real-time chat

3fHNZJ.gif

Spoiler

If I have hurt or offended you in anyway, Please accept my apologies, I never (regardless of the situation) intend to do that to anybody.

Share this post


Link to post
Share on other sites

The same version of the browser(74.0.3729.157), tested with chromedriver74.0 and chromedriver2.38, respectively.The Results is as follows:

Quote

    Starting ChromeDriver 2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb) on port 9515
    Only local connections are allowed.
    DevTools listening on ws://127.0.0.1:12606/devtools/browser/806484b5-cde0-47f0-87b9-fd2493edc5b5
    [3504:1876:0516/020220.273:ERROR:ssl_client_socket_impl.cc(946)] handshake failed; returned -1, SSL error code 1, net_error -101
    [3504:1876:0516/020220.292:ERROR:ssl_client_socket_impl.cc(946)] handshake failed; returned -1, SSL error code 1, net_error -101
    [1016:1296:0516/020236.988:ERROR:ppapi_thread.cc(326)] Failed to load Pepper module from internal-not-yet-present (error: 126)
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    _WDStartup: OS:WIN_7 WIN32_NT 7601 Service Pack 1
    _WDStartup: AutoIt:3.3.14.2
    _WDStartup: WD.au3:0.1.0.19
    _WDStartup: Driver:chromedriver.exe
    _WDStartup: Params:--log-path="D:\MESS\Au3_Selenium\WebDriver-0.1.0.18\Login\chrome.log"
    _WDStartup: Port:9515
    gs\Lay__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true }}}}
    __WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb)","userDataDir":"X:\\MESS\\TEMP\\USER\\scoped_dir5900_28531"},"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":"74.0.3729.157","webStorageEnabled":true},"sessionId":"7e6915e8cafeef8fda5322618d723177"}}
    _WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb)","userDataDir":"X:\\MESS\\TEMP\\USER\\scoped_dir5900_28531"},"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":"74.0.3729.157","webStorageEnabled":true},"sessionId":"7e6915e8cafeef8fda5322618d723177"}}
    __WD_Post: URL=HTTP://127.0.0.1:9515/session/7e6915e8cafeef8fda5322618d723177/url; $sData={"url":"https://www.autoitscript.com/forum/"}
    __WD_Post: StatusCode=200; ResponseText={"value":null}
    _WD_Navigate: {"value":null}
    __WD_Post: URL=HTTP://127.0.0.1:9515/session/7e6915e8cafeef8fda5322618d723177/element; $sData={"using":"partial link text","value":"Sign In"}
    __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"1196ede2-a8bc-48fe-9d2f-81bfcb302fcd"}}
    _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"1196ede2-a8bc-48fe-9d2f-81bfcb302fcd"}}
    __WD_Post: URL=HTTP://127.0.0.1:9515/session/7e6915e8cafeef8fda5322618d723177/element/1196ede2-a8bc-48fe-9d2f-81bfcb302fcd/click; $sData={"id":"1196ede2-a8bc-48fe-9d2f-81bfcb302fcd"}
    __WD_Post: StatusCode=200; ResponseText={"value":null}
    _WD_ElementAction: {"value":null}...
    __WD_Post: URL=HTTP://127.0.0.1:9515/session/7e6915e8cafeef8fda5322618d723177/element; $sData={"using":"xpath","value":"//*[@id=\"elUserSignIn_internal\"]/div/ul/li[1]/input"}
    __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"d0f3e76e-6dd0-4f7b-9526-9934ed22a6f6"}}
    _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"d0f3e76e-6dd0-4f7b-9526-9934ed22a6f6"}}
    __WD_Post: URL=HTTP://127.0.0.1:9515/session/7e6915e8cafeef8fda5322618d723177/element/d0f3e76e-6dd0-4f7b-9526-9934ed22a6f6/value; $sData={"id":"d0f3e76e-6dd0-4f7b-9526-9934ed22a6f6", "text":"username123"}
    __WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=74.0.3729.157)","stacktrace":"Backtrace:\n\t(No symbol) [0x00E3E8F0]\n\t(No symbol) [0x00E27CCD]\n\t(No symbol) [0x00DF6D73]\n\t(No symbol) [0x00DC3753]\n\t(No symbol) [0x00DD6C8D]\n\t(No symbol) [0x00DC2808]\n\t(No symbol) [0x00DD6E81]\n\t(No symbol) [0x00DDE35B]\n\t(No symbol) [0x00DD6CEB]\n\t(No symbol) [0x00DC0D9E]\n\t(No symbol) [0x00DC2314]\n\t(No symbol) [0x00DC22BA]\n\t(No symbol) [0x00E638D6]\n\t(No symbol) [0x00E42AB3]\n\t(No symbol) [0x00E108C6]\n\t(No symbol) [0x00E10BF3]\n\t(No symbol) [0x00E10D03]\n\t(No symbol) [0x00E44B47]\n\t(No symbol) [0x00E1060F]\n\t(No symbol) [0x00E1177E]\n\t(No symbol) [0x00E0D59B]\n\t(No symbol) [0x00E0D6F5]\n\t(No symbol) [0x00E2000B]\n\tBaseThreadInitThunk [0x75EAED6C+18]\n\tRtlInitializeExceptionChain [0x77BB37EB+239]\n\tRtlInitializeExceptionChain [0x77BB37BE+194]\n"}}
    _WD_ElementAction: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=74.0.3729.157...
    _WD_ElementAction ==> Webdriver Exception: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=74.0.3729.157)","stacktrace":"Backtrace:\n\t(No symbol) [0x00E3E8F0]\n\t(No symbol) [0x00E27CCD]\n\t(No symbol) [0x00DF6D73]\n\t(No symbol) [0x00DC3753]\n\t(No symbol) [0x00DD6C8D]\n\t(No symbol) [0x00DC2808]\n\t(No symbol) [0x00DD6E81]\n\t(No symbol) [0x00DDE35B]\n\t(No symbol) [0x00DD6CEB]\n\t(No symbol) [0x00DC0D9E]\n\t(No symbol) [0x00DC2314]\n\t(No symbol) [0x00DC22BA]\n\t(No symbol) [0x00E638D6]\n\t(No symbol) [0x00E42AB3]\n\t(No symbol) [0x00E108C6]\n\t(No symbol) [0x00E10BF3]\n\t(No symbol) [0x00E10D03]\n\t(No symbol) [0x00E44B47]\n\t(No symbol) [0x00E1060F]\n\t(No symbol) [0x00E1177E]\n\t(No symbol) [0x00E0D59B]\n\t(No symbol) [0x00E0D6F5]\n\t(No symbol) [0x00E2000B]\n\tBaseThreadInitThunk [0x75EAED6C+18]\n\tRtlInitializeExceptionChain [0x77BB37EB+239]\n\tRtlInitializeExceptionChain [0x77BB37BE+194]\n"}}
    __WD_Post: URL=HTTP://127.0.0.1:9515/session/7e6915e8cafeef8fda5322618d723177/element; $sData={"using":"xpath","value":"//*[@id=\"elUserSignIn_internal\"]/div/ul/li[2]/input"}
    __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"6d7ced95-8717-405c-90d6-a37473569e26"}}
    _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"6d7ced95-8717-405c-90d6-a37473569e26"}}
    __WD_Post: URL=HTTP://127.0.0.1:9515/session/7e6915e8cafeef8fda5322618d723177/element/6d7ced95-8717-405c-90d6-a37473569e26/value; $sData={"id":"6d7ced95-8717-405c-90d6-a37473569e26", "text":"Password321"}
    __WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=74.0.3729.157)","stacktrace":"Backtrace:\n\t(No symbol) [0x00E3E8F0]\n\t(No symbol) [0x00E27CCD]\n\t(No symbol) [0x00DF6D73]\n\t(No symbol) [0x00DC3753]\n\t(No symbol) [0x00DD6C8D]\n\t(No symbol) [0x00DC2808]\n\t(No symbol) [0x00DD6E81]\n\t(No symbol) [0x00DDE35B]\n\t(No symbol) [0x00DD6CEB]\n\t(No symbol) [0x00DC0D9E]\n\t(No symbol) [0x00DC2314]\n\t(No symbol) [0x00DC22BA]\n\t(No symbol) [0x00E638D6]\n\t(No symbol) [0x00E42AB3]\n\t(No symbol) [0x00E108C6]\n\t(No symbol) [0x00E10BF3]\n\t(No symbol) [0x00E10D03]\n\t(No symbol) [0x00E44B47]\n\t(No symbol) [0x00E1060F]\n\t(No symbol) [0x00E1177E]\n\t(No symbol) [0x00E0D59B]\n\t(No symbol) [0x00E0D6F5]\n\t(No symbol) [0x00E2000B]\n\tBaseThreadInitThunk [0x75EAED6C+18]\n\tRtlInitializeExceptionChain [0x77BB37EB+239]\n\tRtlInitializeExceptionChain [0x77BB37BE+194]\n"}}
    _WD_ElementAction: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=74.0.3729.157...
    _WD_ElementAction ==> Webdriver Exception: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=74.0.3729.157)","stacktrace":"Backtrace:\n\t(No symbol) [0x00E3E8F0]\n\t(No symbol) [0x00E27CCD]\n\t(No symbol) [0x00DF6D73]\n\t(No symbol) [0x00DC3753]\n\t(No symbol) [0x00DD6C8D]\n\t(No symbol) [0x00DC2808]\n\t(No symbol) [0x00DD6E81]\n\t(No symbol) [0x00DDE35B]\n\t(No symbol) [0x00DD6CEB]\n\t(No symbol) [0x00DC0D9E]\n\t(No symbol) [0x00DC2314]\n\t(No symbol) [0x00DC22BA]\n\t(No symbol) [0x00E638D6]\n\t(No symbol) [0x00E42AB3]\n\t(No symbol) [0x00E108C6]\n\t(No symbol) [0x00E10BF3]\n\t(No symbol) [0x00E10D03]\n\t(No symbol) [0x00E44B47]\n\t(No symbol) [0x00E1060F]\n\t(No symbol) [0x00E1177E]\n\t(No symbol) [0x00E0D59B]\n\t(No symbol) [0x00E0D6F5]\n\t(No symbol) [0x00E2000B]\n\tBaseThreadInitThunk [0x75EAED6C+18]\n\tRtlInitializeExceptionChain [0x77BB37EB+239]\n\tRtlInitializeExceptionChain [0x77BB37BE+194]\n"}}
    __WD_Post: URL=HTTP://127.0.0.1:9515/session/7e6915e8cafeef8fda5322618d723177/element; $sData={"using":"xpath","value":"//*[@id=\"elSignIn_submit\"]"}
    __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"3732478a-5d67-493a-bbab-f6a3ae276002"}}
    _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"3732478a-5d67-493a-bbab-f6a3ae276002"}}
    __WD_Post: URL=HTTP://127.0.0.1:9515/session/7e6915e8cafeef8fda5322618d723177/element/3732478a-5d67-493a-bbab-f6a3ae276002/click; $sData={"id":"3732478a-5d67-493a-bbab-f6a3ae276002"}
    __WD_Post: StatusCode=200; ResponseText={"value":null}
 

 

Share this post


Link to post
Share on other sites
Quote

    Starting ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs
    /branch-heads/3729@{#29}) on port 9515
    Only local connections are allowed.
    Please protect ports used by ChromeDriver and related test frameworks to prevent
    access by malicious code.
    --------------------------------------------------------------------------------------
    _WDStartup: OS:WIN_7 WIN32_NT 7601 Service Pack 1
    _WDStartup: AutoIt:3.3.14.2
    _WDStartup: WD.au3:0.1.0.19
    _WDStartup: Driver:chromedriver.exe
    _WDStartup: Params:--log-path="D:\MESS\Au3_Selenium\WebDriver-0.1.0.18\Login\chrome.log"
    _WDStartup: Port:9515
    44 444__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true }}}}
    __WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"unrecognized capability: chromeOptions","stacktrace":"Backtrace:\n\tOrdinal0 [0x0040DB63+1432419]\n\tOrdinal0 [0x00388D81+888193]\n\tOrdinal0 [0x0032B9D1+506321]\n\tOrdinal0 [0x002B640B+25611]\n\tOrdinal0 [0x002DFC33+195635]\n\tOrdinal0 [0x002E0268+197224]\n\tOrdinal0 [0x002E006D+196717]\n\tOrdinal0 [0x002DE8AB+190635]\n\tOrdinal0 [0x002C5F16+89878]\n\tOrdinal0 [0x002C757A+95610]\n\tOrdinal0 [0x002C7474+95348]\n\tGetHandleVerifier [0x0056DE7C+1274156]\n\tGetHandleVerifier [0x004BB6D9+543113]\n\tGetHandleVerifier [0x004BB4E0+542608]\n\tOrdinal0 [0x0041B508+1488136]\n\tGetHandleVerifier [0x004BBC86+544566]\n\tOrdinal0 [0x0039EEC5+978629]\n\tOrdinal0 [0x003AB35B+1028955]\n\tOrdinal0 [0x003AB49F+1029279]\n\tOrdinal0 [0x003AA445+1025093]\n\tBaseThreadInitThunk [0x75EAED6C+18]\n\tRtlInitializeExceptionChain [0x77BB37EB+239]\n\tRtlInitializeExceptionChain [0x77BB37BE+194]\n"}}
    _WD_CreateSession: {"value":{"error":"invalid argument","message":"unrecognized capability: chromeOptions","stacktrace":"Backtrace:\n\tOrdinal0 [0x0040DB63+1432419]\n\tOrdinal0 [0x00388D81+888193]\n\tOrdinal0 [0x0032B9D1+506321]\n\tOrdinal0 [0x002B640B+25611]\n\tOrdinal0 [0x002DFC33+195635]\n\tOrdinal0 [0x002E0268+197224]\n\tOrdinal0 [0x002E006D+196717]\n\tOrdinal0 [0x002DE8AB+190635]\n\tOrdinal0 [0x002C5F16+89878]\n\tOrdinal0 [0x002C757A+95610]\n\tOrdinal0 [0x002C7474+95348]\n\tGetHandleVerifier [0x0056DE7C+1274156]\n\tGetHandleVerifier [0x004BB6D9+543113]\n\tGetHandleVerifier [0x004BB4E0+542608]\n\tOrdinal0 [0x0041B508+1488136]\n\tGetHandleVerifier [0x004BBC86+544566]\n\tOrdinal0 [0x0039EEC5+978629]\n\tOrdinal0 [0x003AB35B+1028955]\n\tOrdinal0 [0x003AB49F+1029279]\n\tOrdinal0 [0x003AA445+1025093]\n\tBaseThreadInitThunk [0x75EAED6C+18]\n\tRtlInitializeExceptionChain [0x77BB37EB+239]\n\tRtlInitializeExceptionChain [0x77BB37BE+194]\n"}}
    _WD_CreateSession ==> Webdriver Exception: unrecognized capability: chromeOptions
    Error occurred in _WD_CreateSession.

 

Share this post


Link to post
Share on other sites
2 hours ago, Letraindusoir said:

Is the chromedriver version inappropriate?

Yes. You need to use the correct version as indicated by @TheDcoder.

15 hours ago, Letraindusoir said:

 $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true }}}}'

Apparently you missed the change they made a while back. The correct string is now "goog:chromeOptions".

 

Share this post


Link to post
Share on other sites
13 hours ago, Danp2 said:

Yes. You need to use the correct version as indicated by @TheDcoder.

Apparently you missed the change they made a while back. The correct string is now "goog:chromeOptionsÔĽŅ".

 

Right enough,It's the root of the mistake. the problems  caused by  the version entraped me....

Thanks for the help!

Share this post


Link to post
Share on other sites

I still know little about webdriver. Prepare to continue to learn to understand the following issues(They may be very simple, but my mind is rigid and I don't have enough knowledge, so....):

1„ÄĀHow and where does chrome add the following options:

#Prohibit loading images

prefs = {
    'profile.default_content_setting_values': {
         'images': 2,
    }
}
#Prohibit loading javascript

prefs = {
    'profile.default_content_setting_values': {
         'javascript': 2,
    }
}

2„ÄĀIs there a function that is functionally equivalent to _ IELoadWait?

3„ÄĀIs there a function that is functionally equivalent to _IEAction($oInput, "focus")

4„ÄĀIs there a function that is functionally equivalent to _IEFormElementGetValue($oInput)

Share this post


Link to post
Share on other sites
30 minutes ago, Letraindusoir said:

How and where does chrome add the following options:

First guess would be in the "goog:chromeOptions" of the DesiredCapabilities parameter that gets passed to _WD_CreateSession. You'll need to experiment to see what works.

34 minutes ago, Letraindusoir said:

Is there a function that is functionally equivalent to _ IELoadWait?

; Name ..........: _WD_LoadWait
; Description ...: Wait for a browser page load to complete before returning

 

42 minutes ago, Letraindusoir said:

Is there a function that is functionally equivalent to _IEAction($oInput, "focus")

Can you provide an example of where this is required?

 

44 minutes ago, Letraindusoir said:

Is there a function that is functionally equivalent to _IEFormElementGetValueÔĽŅ($oInput)

Take a look at _WD_ElementAction with the "text" command.

Share this post


Link to post
Share on other sites

Hi,

I am trying to add a new cookie with an expiry date but not sure about the format of the expiry date. For the code below, I am using the same expiry data retrieved from _WD_Cookies($sSession, 'Get', 'NID').

How can I convert a custom date and time to the integer format to use with _WD_Cookies($sSession, 'add', $sCookie)?

Please help.

#cs
Reference
https://www.w3.org/TR/webdriver/#cookies
https://stackoverflow.com/questions/49985796/cookie-expiry-must-be-a-positive-integer-when-adding-cookie-with-expiry-maximum
https://github.com/mozilla/geckodriver/issues/463
#ce
#include "wd_core.au3"
#include "wd_helper.au3"
Local $sDesiredCapabilities, $sSession
SetupChrome()
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, "http://google.co.in")
Local $sExpiry = 1574415903 ; =>Friday, November 22, 2019 at 3:15:03 PM
Local $sName = "Testname"
Local $sValue = "TestValue"
Local $sCookie = '{"cookie": {"name":"' & $sName & '","value":"' & $sValue  & '","expiry":' & $sExpiry &  '}}'
_WD_Cookies($sSession, 'add', $sCookie)
;_WD_DeleteSession($sSession)
_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 }}}}'
EndFunc

 

Share this post


Link to post
Share on other sites
On 5/21/2019 at 8:19 PM, Danp2 said:

First guess would be in the "goog:chromeOptions" of the DesiredCapabilities parameter that gets passed to _WD_CreateSession. You'll need to experiment to see what works.

Thank you, Danp2, Thanks for your advice and help!

Quote

Is there a function that is functionally equivalent to¬†_IEAction($oInput, "focus")ÔĽŅÔĽŅ

For this,I just want to locate the cursor or mouse to an element after I find it:)

Take the following code as an Test example,How to do this: after finding the element $uElement, before filling in the username,move the cursor or mouse to the position of $uElement?

#include "wd_core.au3"
#include "wd_helper.au3"
Local $url1 = "https://www.autoitscript.com/forum/"

Local $sDesiredCapabilities
SetupChrome();_setupFirefox()
_WD_Startup()
Local $Session=_WD_CreateSession($sDesiredCapabilities)
Sleep(1000)
_WD_Navigate($Session, $url1)
Sleep(1000)

local $sSign_in=_WD_FindElement($Session, $_WD_LOCATOR_ByPartialLinkText,'Sign In')
_WD_ElementAction($Session,$sSign_in, 'click')
Sleep(500)

;How to do this: after finding the element $uElement, before filling in the username,position the cursor or mouse at $uElement?
local $uElement = _WD_FindElement($Session, $_WD_LOCATOR_ByXPath, '//*[@id="elUserSignIn_internal"]/div/ul/li[1]/input')
_WD_ElementAction($Session, $uElement, 'value', "username123")

 

Edited by Letraindusoir

Share this post


Link to post
Share on other sites
#Prohibit loading images

prefs = {
    'profile.default_content_setting_values': {
         'images': 2ÔĽŅ,
    }
}
options.add_experimental_option('prefs',prefs)

This will be left to be tested later. At present,i just want to learn some basic ones.:shifty:

Edited by Letraindusoir

Share this post


Link to post
Share on other sites
2 hours ago, Letraindusoir said:

How to do this: after finding the element $uElement, before filling in the username,move the cursor or mouse to the position of $uElement?

Take a look at the DemoActions function in wd_demo.au3 for an example of moving the mouse pointer to an element.

As far as giving an element focus, just setting its value with _WD_ElementAction should be enough. You could send it a click with _WD_ElementAction as well.

Share this post


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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • 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_HighlightElements($sSession, $aElements[, $iMethod = 1]) _WD_jQuerify($sSession[, $sjQueryFile = Default[, $iTimeout = Default]]) _WD_ElementOptionSelect($sSession, $sStrategy, $sSelector, $sStartElement = "") _WD_ElementSelectAction($sSession, $sSelectElement, $sCommand) _WD_ConsoleVisible($lVisible = False) _WD_LoadWait($sSession[, $iDelay = 0[, $iTimeout = -1[, $sElement = '']]]) _WD_Screenshot($sSession, $sElement = '', $nOutputType = 1) _WD_SelectFiles($sSession, $sStrategy, $sSelector, $sFilename) _WD_GetShadowRoot($sSession, $sStrategy, $sSelector, $sStartElement = "") _WD_IsLatestRelease() _WD_UpdateDriver($sBrowser[, $sInstallDir = Default[, $lFlag64 = Default[, $lForce = Default]]]) _WD_DownloadFile($sURL, $sDest) 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/201106-webdriver-udf-help-support-ii/
       
    • By JohnWIlling
      We are running on a VIrtual Machine via Remote Desktop.  We are having a situation where the loading of the chromedriver.exe is taking longer on the VM than on a physical machine.  It is causing the first call to  WD_Post in _WD_CreateSession to fail.
      To workaround the Issue, I used a simplified version of (_WinAPI_GetTcpTable) UDF to Loop waiting for the driver port to be in the listening state.  At that point, I know that the Post will work:
      Func _WaitForPort($ListenPort) Do Local $tMIB_TCPTABLE = DllStructCreate("dword[6]") Local $aRet = DllCall("Iphlpapi.dll", "DWORD", "GetTcpTable", "struct*", $tMIB_TCPTABLE, "DWORD*", 0, "BOOL", True) Local $dwSize = $aRet[2] $tMIB_TCPTABLE = DllStructCreate("DWORD[" & $dwSize / 4 & "]") $aRet = DllCall("Iphlpapi.dll", "DWORD", "GetTcpTable", "struct*", $tMIB_TCPTABLE, "DWORD*", $dwSize, "BOOL", True) If $aRet[0] <> 0 Then Return SetError(1) Local $iNumEntries = DllStructGetData($tMIB_TCPTABLE, 1, 1) Local $aRes[$iNumEntries][6] For $i = 0 To $iNumEntries - 1 Local $Type = DllStructGetData($tMIB_TCPTABLE, 1, 2 + $i * 5 + 0) $aRet = DllCall("ws2_32.dll", "ushort", "ntohs", "uint", DllStructGetData($tMIB_TCPTABLE, 1, 2 + $i * 5 + 2)) ; local port Local $Port = $aRet[0] ConsoleWrite("Checking Row:" & $i & " State:<" & $Type & "> Port:<" & $Port & ">" & @CRLF) ; Type 2 is LISTENING If $Type = 2 And $Port = $ListenPort Then Return 1; EndIF Next Sleep(500); Until 0; Return 0; EndFunc ;==>_WaitForPort  
    • By svenjatzu
      hey hi
      someone please can help me translate my code to be valid for udf webriver?
       
      #RequireAdmin Opt("WinTitleMatchMode",2) ;~ Sleep(10000) ShellExecute("C:\neu\1.lnk") ;~ Sleep(3000) ;~ $PID = ShellExecute("C:\freeneu\tab.exe") ;~ Sleep(30000*5) WinWait("Example Domain - Iron","") Global $sWinTitle = "Example Domain - Iron" Global $avWinList = WinList($sWinTitle) While $avWinList[0][0] < 1 Sleep(250); Wait for new process to create its GUI $avWinList = WinList($sWinTitle) WEnd For $n = 1 To $avWinList[0][0] WinActivate($avWinList[$n][1]) WinMove($avWinList[$n][1], "", 0, 0, 230, 440) Next Opt("WinTitleMatchMode",1) WinWait("Iron") Sleep(5333) WinWait("Iron") Opt("WinTitleMatchMode",2) WinWaitActive("m:") WinWait("m:") WinClose("m:") ;~ Sleep(5000) Sleep(1000) ;~ ProcessClose("tab.exe") ShellExecute(@ScriptDir & "\q2.exe")  
    • By water
      Internet Explorer is nearly dead, newer versions of Firefox can't any longer be automated using Stilgar's FF UDF.
      Hence more and more users (including me) need to look at automating Webbrowsers using WebDriver.
      That's why I have started to create a tutorial in the wiki.
      It should describe all necessary steps from intallation to usage.

      I'm still collecting ideas for the tutorial - that's where you come into play.
      What do you expect to see in such a tutorial?
      Which browsers should be covered (Firefox, Chrome and Edge are settled)? Any questions for the FAQ? Which (high level) coding examples do you expect (like "How to attach to a running browser instance") ... Like to see your comments
       
      ToDo-List:
      Add "Tools" section and add ChroPath plugin. Done. FAQ: "How to attach to a running browser instance". Done. Explain the difference between iuiautomation, iaccessible, autoit, webdriver. Done. The AutoIt FAQ 40 has been extended. Detailed description of each function. Done Example for "how to deal with downloading". Use function _WD_DownloadFile. Example for "how to deal with popups (alerts, print or save dialog). Use function_WD_AlertRespond to respond to a user prompt. Example for "how to deal with multiple tabs". Use functions _WD_NewTab (create a new tab), _WD_Window (close or switch to a tab) and _WD_Attach (attach to existing tab).
    • By water
      The WebDriver UDF provides a toolbox full of functions to facilitate automating Web browsers.
      Still scripts can become quite complex.
      In this thread users can post "real life" examples to show how specific tasks can be implemented.
      Note
      When posting an example please describe the purpose of the script and the WebDriver functionality used!
       
×
×
  • Create New...