lenclstr746 Posted April 19, 2020 Share Posted April 19, 2020 how can i get chrome url ? Link to comment Share on other sites More sharing options...
Developers Jos Posted April 19, 2020 Developers Share Posted April 19, 2020 2 minutes ago, lenclstr746 said: how can i get chrome url ? How often are you going to ask the same question? Please do not crosspost and stick to a single post, posted at the correct place! (meaning not in the developers forum!) Thanks, Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Danp2 Posted April 19, 2020 Author Share Posted April 19, 2020 @lenclstr746 Using this UDF, the following command will retrieve the current URL from the connected browser session -- _WD_Action($sSession, 'url') You can check it out for yourself by running the DemoNavigation routine in wd_demo.au3 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
lenclstr746 Posted April 19, 2020 Share Posted April 19, 2020 20 minutes ago, Danp2 said: @lenclstr746 Using this UDF, the following command will retrieve the current URL from the connected browser session -- _WD_Action($sSession, 'url') You can check it out for yourself by running the DemoNavigation routine in wd_demo.au3 My wd demo cant do anythin? Link to comment Share on other sites More sharing options...
Danp2 Posted April 19, 2020 Author Share Posted April 19, 2020 @lenclstr746 Please remember that we all volunteer our time in these forums. We are here to provide assistance, but you need to make a reasonable effort on your part. Help us to help you by providing more details because my crystal ball is currently in the shop and I don't know how to fix "doesn't work" without more info. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Purity8 Posted April 19, 2020 Share Posted April 19, 2020 (edited) @lenclstr746. First, you'd need to compile it. Choose 32bit or 64bit, then 'Compile Script'. That'll make an exe version of your scrip (in this case, wd_demo.exe). Now you can run it and click to toggle which "Demo" you like see. I'm not sure which editor you're using. With SciTe editor, you would Ctrl+F7 to compile. Once you've successfully compiled it the first time, you can now use Build (F7) to continue as you make changes to wd_demo.au3 ------------------------------------------------------------ Now back to my own topic... If 'ScriptDir' is used, where exactly is this location? I don't have a 'Script' folder in user profile. Nevermind, I found out. However, I don't see anything like a default folder (Downloads) nor PicturesDir. Is it possible to create dir's? Edited April 19, 2020 by Purity8 Found 'ScriptsDir' Location, editted for more info Link to comment Share on other sites More sharing options...
Danp2 Posted April 19, 2020 Author Share Posted April 19, 2020 1 hour ago, Purity8 said: First, you'd need to compile it That's incorrect. You can run the script directly in Scite by pressing the F5 Key. As far as creating a directory, you could alway try DirCreate. 😃 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Purity8 Posted April 19, 2020 Share Posted April 19, 2020 Perfect, thanks! Well, Gecko seems to be making new profiles...perhaps that's why I had problems. The first time running a new profile in "Debug: None" mode will cause both console & browser to do nothing & display "Demo Complete", delete session & exit console. Link to comment Share on other sites More sharing options...
Purity8 Posted April 19, 2020 Share Posted April 19, 2020 Would this work? DirCreate(@DesktopDir, "/Pictures") Or would I actually have to use the full path? Link to comment Share on other sites More sharing options...
Danp2 Posted April 19, 2020 Author Share Posted April 19, 2020 45 minutes ago, Purity8 said: Gecko seems to be making new profiles That's how Webdriver works, unless you give it directions to use an existing profile. See the FAQ section in the Wiki. Quote Would this work? Nope... because that isn't valid syntax. Did you click the hyperlink I posted earlier or look at the help file? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Purity8 Posted April 19, 2020 Share Posted April 19, 2020 (edited) Yeah, I did but I thought something like would work. I didn't want to use the full path...and it made sense in a way 😂. In Desktop dir, create Pictures. Ah well, was worth a try. I know I gotta use $sFilePath. Edited April 19, 2020 by Purity8 Link to comment Share on other sites More sharing options...
Danp2 Posted April 19, 2020 Author Share Posted April 19, 2020 You can't pass two parameters when then specs only call for one, but you can combine the two strings into a single parameter, like this -- DirCreate(@DesktopDir & "/Pictures") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
HJL Posted April 19, 2020 Share Posted April 19, 2020 (edited) Perfect, thanks a lot. You are working around the clock! Can I also use the same 'rect', '{"x":30,"y":30,"width":100,"height":100}') in $sDesiredCapabilities? Edited April 19, 2020 by HJL Link to comment Share on other sites More sharing options...
Danp2 Posted April 19, 2020 Author Share Posted April 19, 2020 Not sure on that one. You'll need to research that one on your own. 😉 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Purity8 Posted April 20, 2020 Share Posted April 20, 2020 (edited) 14 hours ago, Danp2 said: like this: DirCreate(@DesktopDir & "/Pictures") Well, I did try that. Nothing happened when I ran the script... Oddly, I removed Func & EndFunc, and it worked. edit: With your reference, I managed to solve downloading files to Downloads folder. Thanks 😎 Edited April 20, 2020 by Purity8 Link to comment Share on other sites More sharing options...
seadoggie01 Posted April 22, 2020 Share Posted April 22, 2020 (edited) I'm not sure if this an issue with the UDF or with something else, but I noticed (after an hour of debugging) that a copy of the driver in the local directory can cause the UDF to fail. I store my scripts at work on a network drive and wanted a copy of the driver stored in a central location to be able to copy... so my setup looks like this: C:\Users\seadoggie\Documents\chromedriver.exe <-- a temporary file, will adjust to AppData later. Referenced in script U:\Documents\AutoIt Files\Reports\myScript.au3 U:\Documents\AutoIt Files\Reports\chromedriver.exe <-- the driver to copy to user's computer When there is a copy in the script's directory, _WD_CreateSession fails with Error 9 10 - $_WD_ERROR_Exception. Without a copy in the script's directory, everything works as expected. Maybe someone else can test this? It's strangely specific and it seems like I'm missing something important Edited April 22, 2020 by seadoggie01 Updated to latest UDF version All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
water Posted April 22, 2020 Share Posted April 22, 2020 How do you reference the driver in your script? Did you have a look at the wiki -> FAQ #6? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
seadoggie01 Posted April 22, 2020 Share Posted April 22, 2020 (edited) Yes, I have this in my script: _WD_Option('Driver', @UserProfileDir & "\Documents\chromedriver.exe") I moved the network copy to a sub-directory named Drivers and everything works now. If at any point I copy the driver back to the parent directory, _WD_CreateSession fails. Edit: Reproducable code Spoiler #include <wd_core.au3> Main() Func Main() _WD_Option('Driver', @UserProfileDir & "\Documents\chromedriver.exe") _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path=' & @UserProfileDir & '\Documents\chrome.log') Local $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--profile-directory=Default"]}}}}' _WD_Startup() If @error Then Exit ConsoleWrite("_WD_Startup") Local $sSession = _WD_CreateSession($sDesiredCapabilities) If @error Then Exit ConsoleWrite("_WD_CreateSession Error: " & @error) _WD_DeleteSession($sSession) _WD_Shutdown() EndFunc Edited April 22, 2020 by seadoggie01 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Danp2 Posted April 22, 2020 Author Share Posted April 22, 2020 @seadoggie01 Please post the complete console output when you run the above code. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
seadoggie01 Posted April 22, 2020 Share Posted April 22, 2020 _WDStartup: OS: WIN_10 WIN32_NT 17763 _WDStartup: AutoIt: 3.3.14.5 _WDStartup: WD.au3: 0.2.0.7 _WDStartup: WinHTTP: 1.6.4.1 _WDStartup: Driver: C:\Users\seadoggie\Documents\chromedriver.exe _WDStartup: Params: --log-path=C:\Users\seadoggie\Documents\chrome.log _WDStartup: Port: 9515 __WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":["--profile-directory=Default"]}}}} __WD_Post: StatusCode=0; ResponseText=0 __WD_Post ==> Send / Recv error _WD_CreateSession: 0 _WD_CreateSession ==> Webdriver Exception: HTTP status = 0 _WD_CreateSession Error: 10 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Recommended Posts