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.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

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

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

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
Posted (edited)
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
Posted (edited)
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.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

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

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

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
Posted (edited)
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
Posted (edited)
#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

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

  • 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 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) 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...