Jump to content
Danp2

WebDriver UDF - Help & Support

Recommended Posts

@Danp2 yes, your .scrollIntoView command works very well.

Many thanks.

I do not know if it is important for anyone:

My experiences are at my test, that the .scrollIntoView command did not note if a selected

element has an overlay by another element, like bar etc.

If you try in this case to click the selected element, if gives an error.

 

Share this post


Link to post
Share on other sites

@Danp2 I am needing a command to find a button by text.

 

1.    $aButtons = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@class='primary'] and contains(@class,'editable')]", '', True)
2.    $aButtons = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@class='primary'] and contains(@text,' Testabrechnung starten')]", '', True)

The 1st command is running well.

The 2nd one gives an error:

 

__WD_Post: URL=HTTP://127.0.0.1:4444/session/21217d20-61c8-4b29-a04f-1f1dceaa7687/elements; $sData={"using":"xpath","value":"//button[@class='primary'] and contains(@text,' Testabrechnung starten')]"}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid selector","message":"Given xpath expression \"//button[@class='primary'] and contains(@text,' Testabrechnung starten')]\" is invalid: SyntaxError: The expression is not a legal expression.","stacktrace":"WebDriverError@chrome://marionette/content/error.js:179:5\nInvalidSelectorError@chrome://marionette/content/error.js:337:5\nfind_@chrome://marionette/content/element.js:374:11\nelement.find/</findElements<@chrome://marionette/content/element.js:315:17\nevalFn@chrome://marionette/content/sync.js:144:7\nPollPromise/<@chrome://marionette/content/sync.js:160:5\nPollPromise@chrome://marionette/content/sync.js:135:10\nelement.find/<@chrome://marionette/content/element.js:314:24\nelement.find@chrome://marionette/content/element.js:313:10\nfindElementsContent@chrome://marionette/content/listener.js:1160:19\ndispatch/</req<@chrome://marionette/content/listener.js:485:14\ndispatch/<@chrome://marionette/content/listener.js:480:15\n"}}
_WD_FindElement: {"value":{"error":"invalid selector","message":"Given xpath expression \"//button[@class='primary'] and contains(@text,' Testabrechnung starten')]\" is invalid: SyntaxError: The expression is not a legal expression.","stacktrace":"WebDriverError@chrome://marionette/content/error.js:179:5\nInvalidSelectorError@chrome://marionette/content/error.js:337:5\nfind_@chrome://marionette/content/element.js:374:11\nelement.find/</findElements<@chrome://marionette/content/element.js:315:17\nevalFn@chrome://marionette/content/sync.js:144:7\nPollPromise/<@chrome://marionette/content/sync.js:160:5\nPollPromise@chrome://marionette/content/sync.js:135:10\nelement.find/<@chrome://marionette/content/element.js:314:24\nelement.find@chrome://marionette/content/element.js:313:10\nfindElementsContent@chrome://marionette/content/listener.js:1160:19\ndispatch/</req<@chrome://marionette/content/listener.js:485:14\ndispatch/<@chrome://marionette/content/listener.js:480:15\n"}}
_WD_FindElement ==> Webdriver Exception: HTTP status = 400

Do you know why ?

Share this post


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

ResponseText={"value":{"error":"invalid selector","message":"Given xpath expression \"//button[@class='primary'] and contains(@text,' Testabrechnung starten')]\" is invalid: SyntaxError: The expression is not a legal expression."

It shows you the issue right there. You need to use a valid xpath expression. When you look here, it doesn't list @text as a valid option. Try using text() instead.

Share this post


Link to post
Share on other sites

@Danp2 thanks, text() is working.

I am needing to store in a variable if a button is enabled or disabled.

It should be possible with a function called "isEnabled()"

Do you know the syntax of the command to store this in a variable ?

Share this post


Link to post
Share on other sites
Posted (edited)

I have a windows task scheduled to start at certain time of the day and I was a bit flustered today because the task wouldn't start at the scheduled time. I found out that my Chrome browser updated itself to version 74 and it didn't support my chromedriver version 73. It was good that I was looking at the computer when it failed and I could immediatedly remedy the problem. If I were away, my day would have been ruined.

In order to prevent this from happening again I disabled automatic update of Chrome browser in the task scheduler.  I would like to know if what I did was a recommended preventive measure. Otherwise, is there a way to make the chromedriver updated at the same time the browser is updated?

Edited by CYCho

Share this post


Link to post
Share on other sites

You could add some error checking to your code to detect the mismatch and notify you.  In case you didn't catch it, this is the output from _WD_CreateSession --

__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"session not created","message":"Chrome version must be between 70 and 73","stacktrace":"Backtrace:\n\tOrdinal0 [0x010DC7B3+1427379]\n\tOrdinal0 [0x010574EE+881902]\n\tOrdinal0 [0x00FFA62F+501295]\n\tOrdinal0 [0x00F919BC+72124]\n\tOrdinal0 [0x00F8E31E+58142]\n\tOrdinal0 [0x00FAFD31+195889]\n\tOrdinal0 [0x00FAF6ED+194285]\n\tOrdinal0 [0x00FAE19B+188827]\n\tOrdinal0 [0x00F93EA0+81568]\n\tOrdinal0 [0x00F953DC+87004]\n\tOrdinal0 [0x00F95330+86832]\n\tGetHandleVerifier [0x011923F1+569729]\n\tOrdinal0 [0x010EB383+1487747]\n\tOrdinal0 [0x010EB57D+1488253]\n\tOrdinal0 [0x010EB7DA+1488858]\n\tOrdinal0 [0x010E3DA7+1457575]\n\tOrdinal0 [0x010EB1FF+1487359]\n\tOrdinal0 [0x0106D243+971331]\n\tOrdinal0 [0x01079B4B+1022795]\n\tOrdinal0 [0x01079C9A+1023130]\n\tOrdinal0 [0x01078CB5+1019061]\n\tBaseThreadInitThunk [0x75500419+25]\n\tRtlGetAppContainerNamedObjectPath [0x77A8662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x77A865FD+189]\n"}}
_WD_CreateSession: {"value":{"error":"session not created","message":"Chrome version must be between 70 and 73","stacktrace":"Backtrace:\n\tOrdinal0 [0x010DC7B3+1427379]\n\tOrdinal0 [0x010574EE+881902]\n\tOrdinal0 [0x00FFA62F+501295]\n\tOrdinal0 [0x00F919BC+72124]\n\tOrdinal0 [0x00F8E31E+58142]\n\tOrdinal0 [0x00FAFD31+195889]\n\tOrdinal0 [0x00FAF6ED+194285]\n\tOrdinal0 [0x00FAE19B+188827]\n\tOrdinal0 [0x00F93EA0+81568]\n\tOrdinal0 [0x00F953DC+87004]\n\tOrdinal0 [0x00F95330+86832]\n\tGetHandleVerifier [0x011923F1+569729]\n\tOrdinal0 [0x010EB383+1487747]\n\tOrdinal0 [0x010EB57D+1488253]\n\tOrdinal0 [0x010EB7DA+1488858]\n\tOrdinal0 [0x010E3DA7+1457575]\n\tOrdinal0 [0x010EB1FF+1487359]\n\tOrdinal0 [0x0106D243+971331]\n\tOrdinal0 [0x01079B4B+1022795]\n\tOrdinal0 [0x01079C9A+1023130]\n\tOrdinal0 [0x01078CB5+1019061]\n\tBaseThreadInitThunk [0x75500419+25]\n\tRtlGetAppContainerNamedObjectPath [0x77A8662D+237]\n\tRtlGetAppContainerNamedObjectPath [0x77A865FD+189]\n"}}
_WD_CreateSession ==> Webdriver Exception: Chrome version must be between 70 and 73

 

Share this post


Link to post
Share on other sites

Thank you, @Danp2. I usually have $_WD_DEBUG = False in my code. This morning I had to turn it on to see what was causing the problem. In practice, notifying me of the mismatch is already too late because I would not be nearby to take action. So, for the time being, I will manually update the browser and chromedriver at the same time once in a while.

Share this post


Link to post
Share on other sites

Can't navigate on Firefox, it will open and then console will relaunch and Firefox again.

Quote

_WDStartup: OS:    WIN_10 WIN32_NT 17134
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.1.0.15
_WDStartup: Driver:    geckodriver.exe
_WDStartup: Params:    --log trace
_WDStartup: Port:    4444
__WD_Post: URL=HTTP://127.0.0.1:4444/session; $sData={}
__WD_Post: StatusCode=200; ResponseText={"value":{"sessionId":"0fe6b9d9-be32-4bab-8494-4cc69c8378d8","capabilities":{"acceptInsecureCerts":false,"browserName":"firefox","browserVersion":"66.0.3","moz:accessibilityChecks":false,"moz:geckodriverVersion":"0.24.0","moz:headless":false,"moz:processID":12828,"moz:profile":"C:\\Users\\Arlen\\AppData\\Local\\Temp\\rust_mozprofile.ntY4ZeBcL25Q","moz:shutdownTimeout":60000,"moz:useNonSpecCompliantPointerOrigin":false,"moz:webdriverClick":true,"pageLoadStrategy":"normal","platformName":"windows","platformVersion":"10.0","rotatable":false,"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"}}}
_WD_CreateSession: {"value":{"sessionId":"0fe6b9d9-be32-4bab-8494-4cc69c8378d8","capabilities":{"acceptInsecureCerts":false,"browserName":"firefox","browserVersion":"66.0.3","moz:accessibilityChecks":false,"moz:geckodriverVersion":"0.24.0","moz:headless":false,"moz:processID":12828,"moz:profile":"C:\\Users\\Arlen\\AppData\\Local\\Temp\\rust_mozprofile.ntY4ZeBcL25Q","moz:shutdownTimeout":60000,"moz:useNonSpecCompliantPointerOrigin":false,"moz:webdriverClick":true,"pageLoadStrategy":"normal","platformName":"windows","platformVersion":"10.0","rotatable":false,"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"}}}
__WD_Post: URL=HTTP://127.0.0.1:4444/session/0fe6b9d9-be32-4bab-8494-4cc69c8378d8/window/minimize; $sData=
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"Failed to decode request as JSON: ","stacktrace":"Syntax error at :1:0"}}
_WD_Window: {"value":{"error":"invalid argument","message":"Failed to decode request as JSON: ","stacktrace":"Syntax error at :1:0"}}

Also is it possible to run any browser hidden like IE COM has visible option.

Share this post


Link to post
Share on other sites
Posted (edited)
13 minutes ago, Arlen said:

_WDStartup: WD.au3:    0.1.0.15

This is three releases behind. Please update and then post your code if the issue continues.

13 minutes ago, Arlen said:

Also is it possible to run any browser hidden like IE COM has visible option.

Yes, I believe there is a "headless" option that you can research.

Edited by Danp2
Edit: I see the version info in the __WD_Post output :-)

Share this post


Link to post
Share on other sites
Posted (edited)

This is not working for me:

_ChromeSetInputValueById($sSession,'txt_Username','usertest')
_ChromeSetInputValueById($sSession,'txt_Password','somepw')

Func _ChromeSetInputValueById($sSession,$Id,$Value)
 $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='"&$Id&"']")
 _WD_ElementAction($sSession,$sButton,'value', $Value)
EndFunc
<input style="font-size:12px;font-family:Tahoma,Arial;" id="txt_Password" class="input_login" name="txt_Password" type="password" maxlength="127">
<input style="font-size:12px;font-family:Tahoma,Arial;" id="txt_Username" class="input_login" name="txt_Username" type="text" maxlength="31">

EDIT: I notice that with WD Version 0.1.0.15 it works but with v0.1.0.18 it doesn't work.

Edited by Arlen

Share this post


Link to post
Share on other sites
Posted (edited)
40 minutes ago, Danp2 said:

@Arlen,

Did you solve the earlier FireFox issue? When posting code, it helps if we can actually run what you post. Also, show the results from the Scite output window. This will be much more useful than "not working". 😏

You can't test it unless you have my router to visit the IP or..?, here is the Logs. (Yes it did solve my firefox issue earlier)

Quote

_WDStartup: OS:    WIN_10 WIN32_NT 17134
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.1.0.17
_WDStartup: Driver:    chromedriver.exe
_WDStartup: Params:    --log-path="C:\Users\Arlen\Desktop\Autoit Files\Internet web related\Internet explorer bots\WebDriver\chrome.log"
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":["start-maximized", "disable-infobars"] }}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a)","userDataDir":"C:\\Users\\Arlen\\AppData\\Local\\Temp\\scoped_dir13308_30779"},"cssSelectorsEnabled":true,"databaseEnabled":false,"goog:chromeOptions":{"debuggerAddress":"localhost:64004"},"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,"unhandledPromptBehavior":"","version":"73.0.3683.103","webStorageEnabled":true},"sessionId":"5caad480a25609b46313c2ff2d54b7de"}}
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a)","userDataDir":"C:\\Users\\Arlen\\AppData\\Local\\Temp\\scoped_dir13308_30779"},"cssSelectorsEnabled":true,"databaseEnabled":false,"goog:chromeOptions":{"debuggerAddress":"localhost:64004"},"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,"unhandledPromptBehavior":"","version":"73.0.3683.103","webStorageEnabled":true},"sessionId":"5caad480a25609b46313c2ff2d54b7de"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/5caad480a25609b46313c2ff2d54b7de/url; $sData={"url":"http://10.0.0.1/"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_Navigate: {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/5caad480a25609b46313c2ff2d54b7de/element; $sData={"using":"xpath","value":"//input[@id='txt_Username']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"55dd1ce8-d11e-44a2-8c64-63055d080b30"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"55dd1ce8-d11e-44a2-8c64-63055d080b30"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/5caad480a25609b46313c2ff2d54b7de/element/55dd1ce8-d11e-44a2-8c64-63055d080b30/value; $sData={"id":"55dd1ce8-d11e-44a2-8c64-63055d080b30", "text":"48571235443A22484"}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=73.0.3683.103)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00163CF0+867568]\n\tOrdinal0 [0x0010DB7D+514941]\n\tOrdinal0 [0x000DB367+308071]\n\tOrdinal0 [0x000A6871+92273]\n\tOrdinal0 [0x000BAE8D+175757]\n\tOrdinal0 [0x000A5808+88072]\n\tOrdinal0 [0x000BB111+176401]\n\tOrdinal0 [0x000C278D+206733]\n\tOrdinal0 [0x000BAD2B+175403]\n\tOrdinal0 [0x000A3740+79680]\n\tOrdinal0 [0x000A4CFC+85244]\n\tOrdinal0 [0x000A4C50+85072]\n\tOrdinal0 [0x0016E62A+910890]\n\tOrdinal0 [0x00118993+559507]\n\tOrdinal0 [0x00118BA3+560035]\n\tOrdinal0 [0x00118C8C+560268]\n\tOrdinal0 [0x00171907+923911]\n\tOrdinal0 [0x001187FF+559103]\n\tOrdinal0 [0x0012306E+602222]\n\tOrdinal0 [0x0012EA3B+649787]\n\tOrdinal0 [0x0012EBA5+650149]\n\tOrdinal0 [0x0012DDA5+646565]\n\tBaseThreadInitThunk [0x744E8494+36]\n\tRtlAreBitsSet [0x771941C8+136]\n\tRtlAreBitsSet [0x77194198+88]\n\t(No symbol) [0x00000000]\n"}}
_WD_ElementAction: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=73.0.3683.103...
_WD_ElementAction ==> Webdriver Exception: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=73.0.3683.103)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00163CF0+867568]\n\tOrdinal0 [0x0010DB7D+514941]\n\tOrdinal0 [0x000DB367+308071]\n\tOrdinal0 [0x000A6871+92273]\n\tOrdinal0 [0x000BAE8D+175757]\n\tOrdinal0 [0x000A5808+88072]\n\tOrdinal0 [0x000BB111+176401]\n\tOrdinal0 [0x000C278D+206733]\n\tOrdinal0 [0x000BAD2B+175403]\n\tOrdinal0 [0x000A3740+79680]\n\tOrdinal0 [0x000A4CFC+85244]\n\tOrdinal0 [0x000A4C50+85072]\n\tOrdinal0 [0x0016E62A+910890]\n\tOrdinal0 [0x00118993+559507]\n\tOrdinal0 [0x00118BA3+560035]\n\tOrdinal0 [0x00118C8C+560268]\n\tOrdinal0 [0x00171907+923911]\n\tOrdinal0 [0x001187FF+559103]\n\tOrdinal0 [0x0012306E+602222]\n\tOrdinal0 [0x0012EA3B+649787]\n\tOrdinal0 [0x0012EBA5+650149]\n\tOrdinal0 [0x0012DDA5+646565]\n\tBaseThreadInitThunk [0x744E8494+36]\n\tRtlAreBitsSet [0x771941C8+136]\n\tRtlAreBitsSet [0x77194198+88]\n\t(No symbol) [0x00000000]\n"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/5caad480a25609b46313c2ff2d54b7de/element; $sData={"using":"xpath","value":"//input[@id='txt_Password']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"dc5d3d5a-dddf-49b5-9fa6-d97c0c29a30d"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"dc5d3d5a-dddf-49b5-9fa6-d97c0c29a30d"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/5caad480a25609b46313c2ff2d54b7de/element/dc5d3d5a-dddf-49b5-9fa6-d97c0c29a30d/value; $sData={"id":"dc5d3d5a-dddf-49b5-9fa6-d97c0c29a30d", "text":"prosomething"}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=73.0.3683.103)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00163CF0+867568]\n\tOrdinal0 [0x0010DB7D+514941]\n\tOrdinal0 [0x000DB367+308071]\n\tOrdinal0 [0x000A6871+92273]\n\tOrdinal0 [0x000BAE8D+175757]\n\tOrdinal0 [0x000A5808+88072]\n\tOrdinal0 [0x000BB111+176401]\n\tOrdinal0 [0x000C278D+206733]\n\tOrdinal0 [0x000BAD2B+175403]\n\tOrdinal0 [0x000A3740+79680]\n\tOrdinal0 [0x000A4CFC+85244]\n\tOrdinal0 [0x000A4C50+85072]\n\tOrdinal0 [0x0016E62A+910890]\n\tOrdinal0 [0x00118993+559507]\n\tOrdinal0 [0x00118BA3+560035]\n\tOrdinal0 [0x00118C8C+560268]\n\tOrdinal0 [0x00171907+923911]\n\tOrdinal0 [0x001187FF+559103]\n\tOrdinal0 [0x0012306E+602222]\n\tOrdinal0 [0x0012EA3B+649787]\n\tOrdinal0 [0x0012EBA5+650149]\n\tOrdinal0 [0x0012DDA5+646565]\n\tBaseThreadInitThunk [0x744E8494+36]\n\tRtlAreBitsSet [0x771941C8+136]\n\tRtlAreBitsSet [0x77194198+88]\n\t(No symbol) [0x00000000]\n"}}
_WD_ElementAction: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=73.0.3683.103...
_WD_ElementAction ==> Webdriver Exception: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=73.0.3683.103)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00163CF0+867568]\n\tOrdinal0 [0x0010DB7D+514941]\n\tOrdinal0 [0x000DB367+308071]\n\tOrdinal0 [0x000A6871+92273]\n\tOrdinal0 [0x000BAE8D+175757]\n\tOrdinal0 [0x000A5808+88072]\n\tOrdinal0 [0x000BB111+176401]\n\tOrdinal0 [0x000C278D+206733]\n\tOrdinal0 [0x000BAD2B+175403]\n\tOrdinal0 [0x000A3740+79680]\n\tOrdinal0 [0x000A4CFC+85244]\n\tOrdinal0 [0x000A4C50+85072]\n\tOrdinal0 [0x0016E62A+910890]\n\tOrdinal0 [0x00118993+559507]\n\tOrdinal0 [0x00118BA3+560035]\n\tOrdinal0 [0x00118C8C+560268]\n\tOrdinal0 [0x00171907+923911]\n\tOrdinal0 [0x001187FF+559103]\n\tOrdinal0 [0x0012306E+602222]\n\tOrdinal0 [0x0012EA3B+649787]\n\tOrdinal0 [0x0012EBA5+650149]\n\tOrdinal0 [0x0012DDA5+646565]\n\tBaseThreadInitThunk [0x744E8494+36]\n\tRtlAreBitsSet [0x771941C8+136]\n\tRtlAreBitsSet [0x77194198+88]\n\t(No symbol) [0x00000000]\n"}}

Also it says " _WDStartup: WD.au3:    0.1.0.17 " but it's not true I downloaded the latest with github 0.1.0.18

 

You can test this:

#RequireAdmin
#include <wd_core.au3>
#include <wd_helper.au3>
Global $sDesiredCapabilities = "{}", $sSession
SetupChrome()

_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)

_WD_Navigate($sSession, "https://www.google.com/")
MsgBox(0,"","stop")
_ChromeSetInputValueByClass($sSession,'gLFyf gsfi','abc')

Func _ChromeSetInputValueByClass($sSession,$Class,$Value)
 $sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@Class='"&$Class&"']")
 _WD_ElementAction($sSession,$sButton,'value', $Value)
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, "args":[' & """start-maximized""," & " ""disable-infobars""" & "" & '] }}}}'
EndFunc   ;==>SetupChrome
Quote

_WDStartup: OS:    WIN_10 WIN32_NT 17134
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.1.0.17
_WDStartup: Driver:    chromedriver.exe
_WDStartup: Params:    --log-path="C:\Users\Arlen\Desktop\Autoit Files\Internet web related\Internet explorer bots\WebDriver\chrome.log"
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":["start-maximized", "disable-infobars"] }}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a)","userDataDir":"C:\\Users\\Arlen\\AppData\\Local\\Temp\\scoped_dir11956_2905"},"cssSelectorsEnabled":true,"databaseEnabled":false,"goog:chromeOptions":{"debuggerAddress":"localhost:64573"},"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,"unhandledPromptBehavior":"","version":"73.0.3683.103","webStorageEnabled":true},"sessionId":"b96c9a5f9c5d08315ec453853c31b0ae"}}
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a)","userDataDir":"C:\\Users\\Arlen\\AppData\\Local\\Temp\\scoped_dir11956_2905"},"cssSelectorsEnabled":true,"databaseEnabled":false,"goog:chromeOptions":{"debuggerAddress":"localhost:64573"},"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,"unhandledPromptBehavior":"","version":"73.0.3683.103","webStorageEnabled":true},"sessionId":"b96c9a5f9c5d08315ec453853c31b0ae"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/b96c9a5f9c5d08315ec453853c31b0ae/url; $sData={"url":"https://www.google.com/"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_Navigate: {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/b96c9a5f9c5d08315ec453853c31b0ae/element; $sData={"using":"xpath","value":"//input[@Class='gLFyf gsfi']"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"Unable to locate element{\"method\"\"xpath\",\"selector\"\"//input[@Class='gLFyf gsfi']\"}(Session infochrome=73.0.3683.103)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00163CF0+867568]\n\tOrdinal0 [0x0010DB7D+514941]\n\tOrdinal0 [0x000DB367+308071]\n\tOrdinal0 [0x000A9425+103461]\n\tOrdinal0 [0x000C3B70+211824]\n\tOrdinal0 [0x000BAEC0+175808]\n\tOrdinal0 [0x000C278D+206733]\n\tOrdinal0 [0x000BAD2B+175403]\n\tOrdinal0 [0x000A3740+79680]\n\tOrdinal0 [0x000A4CFC+85244]\n\tOrdinal0 [0x000A4C50+85072]\n\tOrdinal0 [0x0016E62A+910890]\n\tOrdinal0 [0x00118993+559507]\n\tOrdinal0 [0x00118BA3+560035]\n\tOrdinal0 [0x00118C8C+560268]\n\tOrdinal0 [0x00171907+923911]\n\tOrdinal0 [0x001187FF+559103]\n\tOrdinal0 [0x0012306E+602222]\n\tOrdinal0 [0x0012EA3B+649787]\n\tOrdinal0 [0x0012EBA5+650149]\n\tOrdinal0 [0x0012DDA5+646565]\n\tBaseThreadInitThunk [0x744E8494+36]\n\tRtlAreBitsSet [0x771941C8+136]\n\tRtlAreBitsSet [0x77194198+88]\n\t(No symbol) [0x00000000]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"Unable to locate element{\"method\"\"xpath\",\"selector\"\"//input[@Class='gLFyf gsfi']\"}(Session infochrome=73.0.3683.103)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00163CF0+867568]\n\tOrdinal0 [0x0010DB7D+514941]\n\tOrdinal0 [0x000DB367+308071]\n\tOrdinal0 [0x000A9425+103461]\n\tOrdinal0 [0x000C3B70+211824]\n\tOrdinal0 [0x000BAEC0+175808]\n\tOrdinal0 [0x000C278D+206733]\n\tOrdinal0 [0x000BAD2B+175403]\n\tOrdinal0 [0x000A3740+79680]\n\tOrdinal0 [0x000A4CFC+85244]\n\tOrdinal0 [0x000A4C50+85072]\n\tOrdinal0 [0x0016E62A+910890]\n\tOrdinal0 [0x00118993+559507]\n\tOrdinal0 [0x00118BA3+560035]\n\tOrdinal0 [0x00118C8C+560268]\n\tOrdinal0 [0x00171907+923911]\n\tOrdinal0 [0x001187FF+559103]\n\tOrdinal0 [0x0012306E+602222]\n\tOrdinal0 [0x0012EA3B+649787]\n\tOrdinal0 [0x0012EBA5+650149]\n\tOrdinal0 [0x0012DDA5+646565]\n\tBaseThreadInitThunk [0x744E8494+36]\n\tRtlAreBitsSet [0x771941C8+136]\n\tRtlAreBitsSet [0x77194198+88]\n\t(No symbol) [0x00000000]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session/b96c9a5f9c5d08315ec453853c31b0ae/element//value; $sData={"id":"", "text":"abc"}
__WD_Post: StatusCode=500; ResponseText={"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=73.0.3683.103)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00163CF0+867568]\n\tOrdinal0 [0x0010DB7D+514941]\n\tOrdinal0 [0x000DB367+308071]\n\tOrdinal0 [0x000A6871+92273]\n\tOrdinal0 [0x000BAE8D+175757]\n\tOrdinal0 [0x000A5808+88072]\n\tOrdinal0 [0x000BB111+176401]\n\tOrdinal0 [0x000C278D+206733]\n\tOrdinal0 [0x000BAD2B+175403]\n\tOrdinal0 [0x000A3740+79680]\n\tOrdinal0 [0x000A4CFC+85244]\n\tOrdinal0 [0x000A4C50+85072]\n\tOrdinal0 [0x0016E62A+910890]\n\tOrdinal0 [0x00118993+559507]\n\tOrdinal0 [0x00118BA3+560035]\n\tOrdinal0 [0x00118C8C+560268]\n\tOrdinal0 [0x00171907+923911]\n\tOrdinal0 [0x001187FF+559103]\n\tOrdinal0 [0x0012306E+602222]\n\tOrdinal0 [0x0012EA3B+649787]\n\tOrdinal0 [0x0012EBA5+650149]\n\tOrdinal0 [0x0012DDA5+646565]\n\tBaseThreadInitThunk [0x744E8494+36]\n\tRtlAreBitsSet [0x771941C8+136]\n\tRtlAreBitsSet [0x77194198+88]\n\t(No symbol) [0x00000000]\n"}}
_WD_ElementAction: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=73.0.3683.103...
_WD_ElementAction ==> Webdriver Exception: {"value":{"error":"unknown error","message":"'value' must be a list(Session infochrome=73.0.3683.103)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00163CF0+867568]\n\tOrdinal0 [0x0010DB7D+514941]\n\tOrdinal0 [0x000DB367+308071]\n\tOrdinal0 [0x000A6871+92273]\n\tOrdinal0 [0x000BAE8D+175757]\n\tOrdinal0 [0x000A5808+88072]\n\tOrdinal0 [0x000BB111+176401]\n\tOrdinal0 [0x000C278D+206733]\n\tOrdinal0 [0x000BAD2B+175403]\n\tOrdinal0 [0x000A3740+79680]\n\tOrdinal0 [0x000A4CFC+85244]\n\tOrdinal0 [0x000A4C50+85072]\n\tOrdinal0 [0x0016E62A+910890]\n\tOrdinal0 [0x00118993+559507]\n\tOrdinal0 [0x00118BA3+560035]\n\tOrdinal0 [0x00118C8C+560268]\n\tOrdinal0 [0x00171907+923911]\n\tOrdinal0 [0x001187FF+559103]\n\tOrdinal0 [0x0012306E+602222]\n\tOrdinal0 [0x0012EA3B+649787]\n\tOrdinal0 [0x0012EBA5+650149]\n\tOrdinal0 [0x0012DDA5+646565]\n\tBaseThreadInitThunk [0x744E8494+36]\n\tRtlAreBitsSet [0x771941C8+136]\n\tRtlAreBitsSet [0x77194198+88]\n\t(No symbol) [0x00000000]\n"}}

 

Edited by Arlen

Share this post


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

Also it says " _WDStartup: WD.au3:    0.1.0.17 " but it's not true I downloaded the latest with github 0.1.0.18

Thanks for catching that. I've fixed it on Github. You can either redownload it or make the change to the line defining $__WDVERSION.

5 hours ago, Arlen said:

__WD_Post: URL=HTTP://127.0.0.1:9515/session/b96c9a5f9c5d08315ec453853c31b0ae/element; $sData={"using":"xpath","value":"//input[@Class='gLFyf gsfi']"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"Unable to locate element{\"method\"\"xpath\",\"selector\"\"//input[@Class='gLFyf gsfi']\"}

Can't test because _WD_FindElement is failing to find the element.

Share this post


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

Thanks for catching that. I've fixed it on Github. You can either redownload it or make the change to the line defining $__WDVERSION.

Can't test because _WD_FindElement is failing to find the element.

I did some tweaks to make it work for me on version 0.1.0.18.1

Share this post


Link to post
Share on other sites
56 minutes ago, Danp2 said:

@Arlen I assume you mean that you adjusted your script and not the UDF. If not, then please share the changes so that I can understand why they were necessary.

No, it was the UDF.

Before (V0.1.0.18😞

; #FUNCTION# ====================================================================================================================
; Name ..........: _WD_ElementAction
; Description ...: Perform action on desginated element
; Syntax ........: _WD_ElementAction($sSession, $sElement, $sCommand[, $sOption = ''])
; Parameters ....: $sSession            - Session ID from _WDCreateSession
;                  $sElement            - Element ID from _WDFindElement
;                  $sCommand            - Action to be performed
;                  $sOption             - [optional] a string value. Default is ''.
; Return values .: Success      - Requested data returned by web driver
;                  Failure      - ""
;                  @ERROR       - $_WD_ERROR_Success
;                               - $_WD_ERROR_NoMatch
;                               - $_WD_ERROR_Exception
;                               - $_WD_ERROR_InvalidDataType
;                  @EXTENDED    - WinHTTP status code
; Author ........: Dan Pollak
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: https://www.w3.org/TR/webdriver#element-state
;                  https://www.w3.org/TR/webdriver#element-interaction
; Example .......: No
; ===============================================================================================================================
Func _WD_ElementAction($sSession, $sElement, $sCommand, $sOption = '')
    Local Const $sFuncName = "_WD_ElementAction"
    Local $sResponse, $sResult = '', $iErr, $oJson, $sErr

    $sCommand = StringLower($sCommand)

    Switch $sCommand
        Case 'name', 'rect', 'text', 'selected', 'enabled', 'displayed', 'screenshot'
            $sResponse = __WD_Get($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession & "/element/" & $sElement & "/" & $sCommand)
            $iErr = @error

        Case 'active'
            $sResponse = __WD_Get($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession & "/element/" & $sCommand)
            $iErr = @error

        Case 'attribute', 'property', 'css'
            $sResponse = __WD_Get($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession & "/element/" & $sElement & "/" & $sCommand & "/" & $sOption)
            $iErr = @error

        Case 'clear', 'click'
            $sResponse = __WD_Post($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession & "/element/" & $sElement & "/" & $sCommand, '{"id":"' & $sElement & '"}')
            $iErr = @error

        Case 'value'
            $sResponse = __WD_Post($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession & "/element/" & $sElement & "/" & $sCommand, '{"id":"' & $sElement & '", "text":"' & $sOption & '"}')
            $iErr = @error

        Case Else
            Return SetError(__WD_Error($sFuncName, $_WD_ERROR_InvalidDataType, "(Name|Rect|Text|Selected|Enabled|Displayed|Active|Attribute|Property|CSS|Clear|Click|Value|Screenshot) $sCommand=>" & $sCommand), 0, "")

    EndSwitch

    If $iErr = $_WD_ERROR_Success Then
        If $_WD_HTTPRESULT = $HTTP_STATUS_OK Then

            Switch $sCommand
                Case 'clear', 'click', 'value'
                    $sResult = $sResponse

                Case Else
                    $oJson = Json_Decode($sResponse)
                    $sResult = Json_Get($oJson, "[value]")
            EndSwitch

        ElseIf $_WD_HTTPRESULT = $HTTP_STATUS_NOT_FOUND Then
            $oJson = Json_Decode($sResponse)
            $sErr = Json_Get($oJson, "[value][error]")
            $iErr = ($sErr == $WD_Element_Stale) ? $_WD_ERROR_NoMatch : $_WD_ERROR_Exception

        Else
            $iErr = $_WD_ERROR_Exception
        EndIf
    EndIf

    If $_WD_DEBUG = $_WD_DEBUG_Info Then
        ConsoleWrite($sFuncName & ': ' & StringLeft($sResponse,100) & "..." & @CRLF)
    EndIf

    If $iErr Then
        Return SetError(__WD_Error($sFuncName, $iErr, $sResponse), $_WD_HTTPRESULT, "")
    EndIf

    Return SetError($_WD_ERROR_Success, $_WD_HTTPRESULT, $sResult)
EndFunc   ;==>_WD_ElementAction

After(New V0.1.0.18): the change occurred from V0.1.0.15 to V0.1.0.16

; #FUNCTION# ====================================================================================================================
; Name ..........: _WD_ElementAction
; Description ...: Perform action on desginated element
; Syntax ........: _WD_ElementAction($sSession, $sElement, $sCommand[, $sOption = ''])
; Parameters ....: $sSession            - Session ID from _WDCreateSession
;                  $sElement            - Element ID from _WDFindElement
;                  $sCommand            - Action to be performed
;                  $sOption             - [optional] a string value. Default is ''.
; Return values .: Success      - Requested data returned by web driver
;                  Failure      - ""
;                  @ERROR       - $_WD_ERROR_Success
;                               - $_WD_ERROR_NoMatch
;                               - $_WD_ERROR_Exception
;                               - $_WD_ERROR_InvalidDataType
;                  @EXTENDED    - WinHTTP status code
; Author ........: Dan Pollak
; Modified ......:
; Remarks .......:
; Related .......:
; Link ..........: https://www.w3.org/TR/webdriver#element-state
;                  https://www.w3.org/TR/webdriver#element-interaction
; Example .......: No
; ===============================================================================================================================
Func _WD_ElementAction($sSession, $sElement, $sCommand, $sOption = '')
    Local Const $sFuncName = "_WD_ElementAction"
    Local $sResponse, $sResult = '', $iErr, $oJson, $sErr

    $sCommand = StringLower($sCommand)

    Switch $sCommand
        Case 'name', 'rect', 'text', 'selected', 'enabled', 'displayed', 'screenshot'
            $sResponse = __WD_Get($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession & "/element/" & $sElement & "/" & $sCommand)
            $iErr = @error

        Case 'active'
            $sResponse = __WD_Get($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession & "/element/" & $sCommand)
            $iErr = @error

        Case 'attribute', 'property', 'css'
            $sResponse = __WD_Get($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession & "/element/" & $sElement & "/" & $sCommand & "/" & $sOption)
            $iErr = @error

        Case 'clear', 'click'
            $sResponse = __WD_Post($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession & "/element/" & $sElement & "/" & $sCommand, '{"id":"' & $sElement & '"}')
            $iErr = @error

        Case 'value'
            Local $sSplitValue = "[" & StringTrimRight(StringRegExpReplace($sOption, '\\u[[:alnum:]]{4}|.', '"$0",'), 1) & "]"

            $sResponse = __WD_Post($_WD_BASE_URL & ":" & $_WD_PORT & "/session/" & $sSession & "/element/" & $sElement & "/" & $sCommand, '{"id":"' & $sElement & '", "text":"' & $sOption & '", "value":' & $sSplitValue & '}')
            $iErr = @error

            If $iErr = $_WD_ERROR_Success Then
                $sResult = $sResponse
            EndIf

        Case Else
            Return SetError(__WD_Error($sFuncName, $_WD_ERROR_InvalidDataType, "(Name|Rect|Text|Selected|Enabled|Displayed|Active|Attribute|Property|CSS|Clear|Click|Value|Screenshot) $sCommand=>" & $sCommand), 0, "")

    EndSwitch

    If $iErr = $_WD_ERROR_Success Then
        If $_WD_HTTPRESULT = $HTTP_STATUS_OK Then

            Switch $sCommand
                Case 'clear', 'click', 'value'
                    $sResult = $sResponse

                Case Else
                    $oJson = Json_Decode($sResponse)
                    $sResult = Json_Get($oJson, "[value]")
            EndSwitch

        ElseIf $_WD_HTTPRESULT = $HTTP_STATUS_NOT_FOUND Then
            $oJson = Json_Decode($sResponse)
            $sErr = Json_Get($oJson, "[value][error]")
            $iErr = ($sErr == $WD_Element_Stale) ? $_WD_ERROR_NoMatch : $_WD_ERROR_Exception

        Else
            $iErr = $_WD_ERROR_Exception
        EndIf
    EndIf

    If $_WD_DEBUG = $_WD_DEBUG_Info Then
        ConsoleWrite($sFuncName & ': ' & StringLeft($sResponse,100) & "..." & @CRLF)
    EndIf

    If $iErr Then
        Return SetError(__WD_Error($sFuncName, $iErr, $sResponse), $_WD_HTTPRESULT, "")
    EndIf

    Return SetError($_WD_ERROR_Success, $_WD_HTTPRESULT, $sResult)
EndFunc   ;==>_WD_ElementAction

Difference is on the case 'value' section.

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, Danp2 said:

This is way out of date. Update to the correct version and then retry with the unchanged UDF

Chrome won't open. Updated chromedriver.exe

I get this msg on Console: "Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code." I have AV BTW.

Quote

_WDStartup: OS:    WIN_10 WIN32_NT 17134
_WDStartup: AutoIt:    3.3.14.5
_WDStartup: WD.au3:    0.1.0.18
_WDStartup: Driver:    chromedriver.exe
_WDStartup: Params:    --log-path="C:\Users\Arlen\Desktop\Autoit Files\Internet web related\Internet explorer bots\WebDriver\chrome.log"
_WDStartup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":["start-maximized", "disable-infobars"] }}}}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"unrecognized capability: chromeOptions","stacktrace":"Backtrace:\n\tOrdinal0 [0x003EDB63+1432419]\n\tOrdinal0 [0x00368D81+888193]\n\tOrdinal0 [0x0030B9D1+506321]\n\tOrdinal0 [0x0029640B+25611]\n\tOrdinal0 [0x002BFC33+195635]\n\tOrdinal0 [0x002C0268+197224]\n\tOrdinal0 [0x002C006D+196717]\n\tOrdinal0 [0x002BE8AB+190635]\n\tOrdinal0 [0x002A5F16+89878]\n\tOrdinal0 [0x002A757A+95610]\n\tOrdinal0 [0x002A7474+95348]\n\tGetHandleVerifier [0x0054DE7C+1274156]\n\tGetHandleVerifier [0x0049B6D9+543113]\n\tGetHandleVerifier [0x0049B4E0+542608]\n\tOrdinal0 [0x003FB508+1488136]\n\tGetHandleVerifier [0x0049BC86+544566]\n\tOrdinal0 [0x0037EEC5+978629]\n\tOrdinal0 [0x0038B35B+1028955]\n\tOrdinal0 [0x0038B49F+1029279]\n\tOrdinal0 [0x0038A445+1025093]\n\tBaseThreadInitThunk [0x744E8494+36]\n\tRtlAreBitsSet [0x771941C8+136]\n\tRtlAreBitsSet [0x77194198+88]\n"}}
_WD_CreateSession: {"value":{"error":"invalid argument","message":"unrecognized capability: chromeOptions","stacktrace":"Backtrace:\n\tOrdinal0 [0x003EDB63+1432419]\n\tOrdinal0 [0x00368D81+888193]\n\tOrdinal0 [0x0030B9D1+506321]\n\tOrdinal0 [0x0029640B+25611]\n\tOrdinal0 [0x002BFC33+195635]\n\tOrdinal0 [0x002C0268+197224]\n\tOrdinal0 [0x002C006D+196717]\n\tOrdinal0 [0x002BE8AB+190635]\n\tOrdinal0 [0x002A5F16+89878]\n\tOrdinal0 [0x002A757A+95610]\n\tOrdinal0 [0x002A7474+95348]\n\tGetHandleVerifier [0x0054DE7C+1274156]\n\tGetHandleVerifier [0x0049B6D9+543113]\n\tGetHandleVerifier [0x0049B4E0+542608]\n\tOrdinal0 [0x003FB508+1488136]\n\tGetHandleVerifier [0x0049BC86+544566]\n\tOrdinal0 [0x0037EEC5+978629]\n\tOrdinal0 [0x0038B35B+1028955]\n\tOrdinal0 [0x0038B49F+1029279]\n\tOrdinal0 [0x0038A445+1025093]\n\tBaseThreadInitThunk [0x744E8494+36]\n\tRtlAreBitsSet [0x771941C8+136]\n\tRtlAreBitsSet [0x77194198+88]\n"}}
_WD_CreateSession ==> Webdriver Exception: unrecognized capability: chromeOptions
__WD_Post: URL=HTTP://127.0.0.1:9515/session//url; $sData={"url":"https://www.google.com/"}
__WD_Post: StatusCode=200; ResponseText={"sessionId":"","status":6,"value":{"message":"invalid session id\n  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17134 x86_64)"}}
_WD_Navigate: {"sessionId":"","status":6,"value":{"message":"invalid session id\n  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17134 x86_64)"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element; $sData={"using":"xpath","value":"//input[@class='gLFyf gsfi']"}
__WD_Post: StatusCode=200; ResponseText={"sessionId":"","status":6,"value":{"message":"invalid session id\n  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17134 x86_64)"}}
_WD_FindElement: {"sessionId":"","status":6,"value":{"message":"invalid session id\n  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17134 x86_64)"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session//element//value; $sData={"id":"", "text":"abc"}
__WD_Post: StatusCode=200; ResponseText={"sessionId":"","status":6,"value":{"message":"invalid session id\n  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17134 x86_64)"}}
_WD_ElementAction: {"sessionId":"","status":6,"value":{"message":"invalid session id\n  (Driver info: chromedriver=74.0...

 

Edited by Arlen

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