Jump to content

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. 😉

Link to comment
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.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
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
Link to comment
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
Link to comment
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.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
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}
 

 

Link to comment
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.

 

Link to comment
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".

 

Link to comment
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!

Link to comment
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)

Link to comment
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.

Link to comment
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

 

Link to comment
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
Link to comment
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
Link to comment
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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...