Jury Posted August 22, 2020 Share Posted August 22, 2020 (edited) When I updated my geckodriver.exe now my script give me this: _WD_IsLatestRelease: True _WD_IsLatestRelease ==> Success _WDStartup: OS: WIN_10 WIN32_NT 18362 _WDStartup: AutoIt: 3.3.14.5 _WDStartup: WD.au3: 0.3.0.7 (Up to date) _WDStartup: WinHTTP: 1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>) _WDStartup: Driver: C:\Users\PC1\Documents\Dropbox\autoit_new\resources\geckodriver.exe _WDStartup: Params: _WDStartup: Port: 4444 __WD_Post: URL=HTTP://127.0.0.1:4444/session; $sData={"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}} __WD_Post: StatusCode=500; ResponseText={"value":{"error":"session not created","message":"Expected browser binary location, but unable to f... __WD_Post ==> Webdriver Exception: {"value":{"error":"session not created","message":"Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line","stacktrace":""}} _WD_CreateSession: {"value":{"error":"session not created","message":"Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line","stacktrace":""}} _WD_CreateSession ==> Webdriver Exception: HTTP status = 500 __WD_Post: URL=HTTP://127.0.0.1:4444/session//url; $sData={"url":"https://..."} __WD_Post: StatusCode=405; ResponseText=HTTP method not allowed... _WD_Navigate: HTTP method not allowed I don't understand and can't see anything in the geckodriver update information that seems to apply. BTW: I see this now: _WDStartup: WinHTTP: 1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>) Edited August 22, 2020 by Jury Link to comment Share on other sites More sharing options...
Danp2 Posted August 22, 2020 Author Share Posted August 22, 2020 Yes, definitely update your WinHTTP from the provided link. I believe your other issue will be resolved by using the x64 version of geckodriver. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Jury Posted August 22, 2020 Share Posted August 22, 2020 Oh yes thanks, Link to comment Share on other sites More sharing options...
TheXman Posted August 24, 2020 Share Posted August 24, 2020 (edited) I was about to use the WebDriver UDF for the first time but noticed that v0.3.0.7 zip file's comment has what looks like a SHA1 hash, which I assume is used to verify the zip file's integrity. If that is what it is, then it does not match the zip file's calculated SHA1 hash. If the zip file's comment is not supposed to be the file's SHA1 hash or it's no longer maintained, then please disregard this post. If it is supposed to be the file's current SHA1 hash, is it safe to assume that the file was updated but the hash was not and that the current contents are okay? 21EBE3A418EBC3F5385C8FB4ECABB5E652208D57 (zip file's current comment) 0108A80EE0497B983BC01022B70F356C0B67AE4C (calculated SHA1 hash) Edited August 24, 2020 by TheXman Redacted profile name CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Danp2 Posted August 24, 2020 Author Share Posted August 24, 2020 (edited) @TheXman Not sure where that comes from TBH. Must be something automatically occurring when I publish a new release. 🤷♂️ Edit: Turns out that is the commit from when the release was created, ie: https://github.com/Danp2/WebDriver/commit/21ebe3a418ebc3f5385c8fb4ecabb5e652208d57 😆 Edited August 24, 2020 by Danp2 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
TheXman Posted August 24, 2020 Share Posted August 24, 2020 (edited) Okay thanks. If it's something that's being added by Github, then I'll just ignore it. Edited August 24, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
hemal Posted August 26, 2020 Share Posted August 26, 2020 Hi Dan, Need your help here. On the site there is an Input box. At launch it stays inactive and need to write a code to wait until it gets activated. Can I use _WD_ElementAction and how... Thanks Link to comment Share on other sites More sharing options...
Danp2 Posted August 26, 2020 Author Share Posted August 26, 2020 @hemal Yes, you should be able to call _WD_ElementAction with the Enabled command to test if an element is enabled or disabled. Give it a shot and then let us know your outcome. hemal 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
hemal Posted August 27, 2020 Share Posted August 27, 2020 (edited) My Debug.log shows this error, any idea how to trace this? [0827/124417.110:ERROR:exception_snapshot_win.cc(98)] thread ID 18920 not found in process [0827/124417.160:ERROR:process_reader_win.cc(123)] NtOpenThread: {Access Denied} A process has requested access to an object, but has not been granted those access rights. (0xc0000022) Can we write custom text in Chrome.log? if yes how.... Edited August 27, 2020 by hemal Link to comment Share on other sites More sharing options...
Danp2 Posted August 27, 2020 Author Share Posted August 27, 2020 @hemal Did this produce any errors or unexpected results on the Autoit side? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
hemal Posted August 27, 2020 Share Posted August 27, 2020 1 hour ago, Danp2 said: @hemal Did this produce any errors or unexpected results on the Autoit side? No Its not creating any unexpected result. But just want to make sure the full proof script. I am not aware about the impact. Secondly, Can we put or write lines in chrome.log file? or you suggest to write status log in separate file. Link to comment Share on other sites More sharing options...
Danp2 Posted August 27, 2020 Author Share Posted August 27, 2020 @hemal If you want to investigate the errors from the Chrome log, then I would recommend checking Google for similar errors. As far as logging goes, you probably can't output to the same file due to locking issues, so using a separate file is recommended. FYI, the most recent UDF release allows you to log to a file instead of the Scite console. hemal 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Tim772 Posted August 31, 2020 Share Posted August 31, 2020 Hello all, can someone please let me know if I can start a session in chrome with shellexecute and access to this session with WebDriver. When I am already logged in into a website I do not want to start a new session to login again with the WebDriver. So my plan is to access to a website, which requires to log in and access to the site with the WebDriver. I don't want to login with the WebDriver since it would require additional efforts to make it safe. I have tried a lot with the demo, which is really great. But I don't know how to handle that. I have tried the examples of previous posts, but it doesn't work. Hope someone can help me Thanks in advance! Link to comment Share on other sites More sharing options...
Danp2 Posted August 31, 2020 Author Share Posted August 31, 2020 @Tim772 The only way I know is to use the --remote-debugging-port parameter when launching Chrome. You can then use this same port number to communicate with the existing Chrome instance. Here's a simple example -- #include "wd_core.au3" Local $sDesiredCapabilities, $sSession ShellExecute("chrome.exe", "--remote-debugging-port=9222") SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "http://yahoo.com") Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"debuggerAddress": "localhost:9222"}}}}' EndFunc Note: there are limitations to using this feature Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
this-is-me Posted September 3, 2020 Share Posted September 3, 2020 I would like to allow the Chrome instance I use to automatically update. The problem is that if Chrome updates, then the Chrome driver needs to be updated as well or otherwise it throws an error. Could a feature be added to automatically download and use the Chrome driver specific to the version of Chrome? I don't mind downloading 7-zip command line version once to allow this script to extract the latest driver, but updating the driver so often can be a pain. Who else would I be? Link to comment Share on other sites More sharing options...
Danp2 Posted September 3, 2020 Author Share Posted September 3, 2020 @this-is-me Take a look at _WD_UpdateDriver, which already implements the requested feature. 😎 this-is-me 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
this-is-me Posted September 3, 2020 Share Posted September 3, 2020 🤦♂️Duh. Sorry. 1 minute ago, Danp2 said: @this-is-me Take a look at _WD_UpdateDriver, which already implements the requested feature. 😎 Danp2 1 Who else would I be? Link to comment Share on other sites More sharing options...
SamsonSlice Posted September 4, 2020 Share Posted September 4, 2020 Hey all just wanted to share some code if you're struggling to send keys to your web session. Here is how I was able to send an "ENTER" keystroke to my web session: _WD_Action($sSession, 'actions', '{"actions": [{"type": "key", "id": "keyboard", "actions": [{"type": "keyDown", "value": "\uE007"}, {"type": "keyUp", "value": "\uE007"}]}]}') Spent many hours trying to figure the sequence out. Hopefully this can help someone. @giahh - Saw you trying to do this back in 2018 Referenced:https://github.com/jlipps/simple-wd-spec#perform-actions ThePoro, MohamedEmara, daledale and 1 other 4 Link to comment Share on other sites More sharing options...
drr Posted September 5, 2020 Share Posted September 5, 2020 (edited) Hello, I'm trying to get innerHTML attribute of the element on w3 webpage via chrome. But it comes back empty. What am I doing wrong? Here is example script: #include "wd_core.au3" #include "wd_helper.au3" #include "debug.au3" Local $sSession, $sDesiredCapabilities SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_LoadWait($sSession) _WD_Navigate($sSession, "https://www.w3.org/") _WD_LoadWait($sSession) Sleep (10000) $sEl = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@id='w3c_container']") $html = _WD_ElementAction($sSession, $sEl , 'Attribute', 'innerhtml') MsgBox (0,"",$html) _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 And the output in Scite: __WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}} __WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"85.0.... _WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"85.0.4183.83","chrome":{"chromedriverVersion":"84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310})","userDataDir":"C:\\Users\\User1\\AppData\\Local\\Temp\\scoped_dir20792_1909389831"},"goog:chromeOptions":{"debuggerAddress":"localhost:54985"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:virtualAuthenticators":true},"sessionId":"a99a05f4fc74fc83ef07e96425615ef3"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/a99a05f4fc74fc83ef07e96425615ef3/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=200; ResponseText={"value":"complete"}... _WD_ExecuteScript: {"value":"complete"}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/a99a05f4fc74fc83ef07e96425615ef3/url; $sData={"url":"https://www.w3.org/"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_Navigate: {"value":null} __WD_Post: URL=HTTP://127.0.0.1:9515/session/a99a05f4fc74fc83ef07e96425615ef3/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=200; ResponseText={"value":"complete"}... _WD_ExecuteScript: {"value":"complete"}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/a99a05f4fc74fc83ef07e96425615ef3/element; $sData={"using":"xpath","value":"//div[@id='w3c_container']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"a3c19afc-bab9-4627-b4c2-3f51946cc017"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"a3c19afc-bab9-4627-b4c2-3f51946cc017"}} __WD_Get: URL=HTTP://127.0.0.1:9515/session/a99a05f4fc74fc83ef07e96425615ef3/element/a3c19afc-bab9-4627-b4c2-3f51946cc017/attribute/innerhtml __WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":null}... _WD_ElementAction: {"value":null}... Thanks for any directions! Edited September 5, 2020 by drr Link to comment Share on other sites More sharing options...
Danp2 Posted September 5, 2020 Author Share Posted September 5, 2020 1 hour ago, drr said: $html = _WD_ElementAction($sSession, $sEl , 'Attribute', 'innerhtml') In this situation, you have to pass the attribute or property name using the proper case. The process is returning a Null because it can't find an attribute named "innerhtml". Change this to "innerHTML" and it should give you the desired result. drr 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts