Danp2 Posted January 17, 2018 Share Posted January 17, 2018 (edited) 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/ HtmlTable2Array UDF (optional) https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/ WebDriver for desired browser Chrome WebDriver https://sites.google.com/a/chromium.org/chromedriver/downloads FireFox WebDriver https://github.com/mozilla/geckodriver/releases Edge WebDriver https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ Source Code You will always be able to find the latest version in the GitHub Repo Help / Support See the wiki for details on the UDF -- https://www.autoitscript.com/wiki/WebDriver Please post any questions, suggestions or errors in the GH&S thread. https://www.autoitscript.com/forum/topic/208640-webdriver-udf-help-support-iv/#comments Previous support threads (Closed) https://www.autoitscript.com/forum/topic/192730-webdriver-udf-help-support/https://www.autoitscript.com/forum/topic/201106-webdriver-udf-help-support-ii/https://www.autoitscript.com/forum/topic/205553-webdriver-udf-help-support-iii/ Edited May 23 by Danp2 cramaboule 1 WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted January 17, 2018 Author Share Posted January 17, 2018 I'm sure there are some bugs. Please post any issues you encounter. Also would appreciate any feedback / suggestions. Note: not all WebDriver functions have been implemented by each browser. To check the status, click on the below link for each respective browser -- - Firefox - Chrome WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
NguyenLe Posted January 20, 2018 Share Posted January 20, 2018 It not working Can you help me? Link to comment Share on other sites More sharing options...
Danp2 Posted January 20, 2018 Author Share Posted January 20, 2018 You'll need to be more specific because I don't know how to fix "not working". Is it just not launching Chrome or what? What version of Autoit are you using? Ditto for Chrome. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
NguyenLe Posted January 20, 2018 Share Posted January 20, 2018 13 minutes ago, Danp2 said: You'll need to be more specific because I don't know how to fix "not working". Is it just not launching Chrome or what? What version of Autoit are you using? Ditto for Chrome. I am using Atuoti v3 Link to comment Share on other sites More sharing options...
Danp2 Posted January 20, 2018 Author Share Posted January 20, 2018 Does the script just hang at that point? How long have you waited? Please post the complete results of the Scite output window. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
NguyenLe Posted January 20, 2018 Share Posted January 20, 2018 My complete results: _WDStartup: OS: WIN_7 WIN32_NT 7601 Service Pack 1 _WDStartup: AutoIt: 3.3.14.2 _WDStartup: WD.au3: 0.1.0.1b-1 _WDStartup: Driver: chromedriver.exe _WDStartup: Params: --log-path=D:\New folder\New folder\auto4 V1.651\chrome.log _WDStartup: Port: 9515 __WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true }}}} Link to comment Share on other sites More sharing options...
Danp2 Posted January 20, 2018 Author Share Posted January 20, 2018 Ok... so you're running Autoit 3.3.14.2. Now, how about Chrome? What version and is it installed in the default location? Also, what happens at this point in the script? Is the script still running (it appears to be)? Does it just hang or pause? For how long? WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
NguyenLe Posted January 20, 2018 Share Posted January 20, 2018 The version of Chrome which I am using is 63.0.3239.132 Nothing happens while running the code and the script is running Link to comment Share on other sites More sharing options...
Danp2 Posted January 20, 2018 Author Share Posted January 20, 2018 11 minutes ago, Danp2 said: Now, how about Chrome? What version and is it installed in the default location? @NguyenLe Please answer the bolded portion of my earlier question. If Chome isn't installed in the default location, then ChromeDriver can't locate it in order to launch it. This can be addressed, but you then have to indicate this location to the ChromeDriver. Also, check the chrome.log file located in the script directory to see if it gives any additional information that may help with this issue. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
NguyenLe Posted January 20, 2018 Share Posted January 20, 2018 The default location of Chrome: C:\Program Files (x86)\Google\Chrome\Application The version of Chrome: 63.0.3239.132 Link to comment Share on other sites More sharing options...
Danp2 Posted January 20, 2018 Author Share Posted January 20, 2018 @NguyenLe Please let me know if you did the follow as previously requested. 8 hours ago, Danp2 said: Also, check the chrome.log file located in the script directory to see if it gives any additional information that may help with this issue. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
NguyenLe Posted January 20, 2018 Share Posted January 20, 2018 Thank you Danp2. I'm glad I was able to use it normally after rebooting. Thanks for your answers Link to comment Share on other sites More sharing options...
NguyenLe Posted January 20, 2018 Share Posted January 20, 2018 How do I open multi Tab in Chrome? Thank you very much Link to comment Share on other sites More sharing options...
Danp2 Posted January 20, 2018 Author Share Posted January 20, 2018 Good question. Not sure to be honest. I'll post back if I come up with a good example. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
NguyenLe Posted January 20, 2018 Share Posted January 20, 2018 Ok, Thank you very much about your UDF. Link to comment Share on other sites More sharing options...
Danp2 Posted January 20, 2018 Author Share Posted January 20, 2018 Looks like you can do it with the Execute Script feature -- _WDExecuteScript($sSession, 'window.open()', '{}') Once the tab is created, you will need to switch to it using the correct commands before you can interact with it. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted January 21, 2018 Author Share Posted January 21, 2018 Here's a helper function for creating a new tab and optionally switching to it -- Func _WD_NewTab($sSession, $lSwitch = True) _WDExecuteScript($sSession, 'window.open()', '{}') Local $aHandles = _WDWindow($sSession, 'handles', '') If $lSwitch Then _WDWindow($sSession, 'Switch', '{"handle":"' & $aHandles[UBound($aHandles) - 1] & '"}') EndIf EndFunc duzers 1 WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
NguyenLe Posted January 21, 2018 Share Posted January 21, 2018 Ok thank you Can you add to your UDF for everyone to use? Link to comment Share on other sites More sharing options...
Danp2 Posted January 21, 2018 Author Share Posted January 21, 2018 Yes. I'll continue to add functions as necessary to better enable to use of the UDF. At this point, need to determine if these "helper" functions belong in a separate source file. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now