If You want to test different browsers speed then You can do it with webdriver API:
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=69390
RPAChallenge with AHK, COM, and JSWrapper.ahk
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
Thanks, @malcev. I can run the example you posted in that thread. But I downloaded the github repository for AHKWebDriver.ahk, and I can't get any of those examples to run.
But I probably misunderstood. Did you mean that I should use the WebDriver API itself rather than AHKWebDriver.ahk?
Regards,
burque505
But I probably misunderstood. Did you mean that I should use the WebDriver API itself rather than AHKWebDriver.ahk?
Regards,
burque505
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
After addingburque505 wrote: ↑07 Jul 2020, 18:07This is just for reference, not for speed. Plain Vanilla AHK, 816ms. No artificial flavors, preservatives or sweeteners.Code: Select all
URLDownloadToFile, http://rpachallenge.com/assets/downloadFiles/challenge.xlsx, challenge.xlsx ; Create arrays for each Excel column firstNameArray := [] lastNameArray := [] companyNameArray := [] roleArray := [] addressArray := [] emailArray := [] phoneArray := [] lastrow := 0 ; Used later path := A_ScriptDir xl := ComObjCreate("Excel.Application") xl.Visible := true xl.Workbooks.Open(path . "\challenge.xlsx") ;loop to fill the arrays while (Xl.Range("A" . A_Index).Value != "") { indexer := A_Index -1 firstNameArray[indexer] := Xl.Range("A" . A_Index).Value lastNameArray[indexer] := Xl.Range("B" . A_Index).Value companyNameArray[indexer] := Xl.Range("C" . A_Index).Value roleArray[indexer] := Xl.Range("D" . A_Index).Value addressArray[indexer] := Xl.Range("E" . A_Index).Value emailArray[indexer] := Xl.Range("F" . A_Index).Value phoneArray[indexer] := Xl.Range("G" . A_Index).Value lastrow := A_Index -1 } ; Don't need Excel anymore. xl.Quit ie := ComObjCreate("InternetExplorer.Application") ie.Visible := true ; This is known to work incorrectly on IE7. ie.Navigate("http://rpachallenge.com") while (ie.Busy) sleep, 100 doc := ie.Document doc.querySelector("button.waves-effect").click() loop, %lastrow% { fnvar = % firstNameArray[A_Index] lnvar = % lastNameArray[A_Index] cnvar = % companyNameArray[A_Index] rolevar = % roleArray[A_Index] addressvar = % addressArray[A_Index] emailvar = % emailArray[A_Index] phonevar = % phoneArray[A_Index] doc.querySelector("input[ng-reflect-name='labelEmail']").value := emailvar doc.querySelector("input[ng-reflect-name='labelAddress']").value := addressvar doc.querySelector("input[ng-reflect-name='labelFirstName']").value := fnvar doc.querySelector("input[ng-reflect-name='labelLastName']").value := lnvar doc.querySelector("input[ng-reflect-name='labelPhone']").value := phonevar doc.querySelector("input[ng-reflect-name='labelRole']").value := rolevar doc.querySelector("input[ng-reflect-name='labelCompanyName']").value := cnvar doc.querySelector("input[value='Submit']").click() } ; end loop sleep, 5000 ie.quit()
SetBatchLines, -1
I used your code and it did it in 490ms
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
@AHKStudent, great tip. That got me down to 442ms on a Win10 machine, old but has 32GB RAM and an SSD hard disk, so it's not that slow.
Regards,
burque505
Regards,
burque505
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
burque505, for me examples work.
I put AHKWebDriver.ahk and json.ahk to the folder of examples, run chromedriver and then run test_url.ahk.
I put AHKWebDriver.ahk and json.ahk to the folder of examples, run chromedriver and then run test_url.ahk.
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
@malcev, I didn't have that kind of luck. My files are exactly where you placed yours, but I get this error with test_url.ahk:
I'm using json.ahk from the repo; I'll try one from my file system now.
Regards,
burque505
Code: Select all
Error in #include file <My File Path>:
0x800C0005 -
Source: msxml3.dll
Description: The system cannot locate the resource specified.
HelpFile: (null)
HelpContext: 0
Specifically: Send
Line#
393: Return,""
394: Return,this.rc.value
395: }
399: {
401: rc := {}
402: WS_SERVIDOR.Open(metodo,url, false)
403: WS_SERVIDOR.setRequestHeader("Content-Type","application/json; charset=UTF-8")
---> 404: WS_SERVIDOR.Send(cuerpo)
405: rc.status := WS_SERVIDOR.Status
406: rc.isError := (WS_SERVIDOR.Status < 200 || WS_SERVIDOR.Status > 299)
407: rc.raw := WS_SERVIDOR.ResponseText
408: rc.value := JSON.Parse(rc.raw).value
409: rc.sendRaw := cuerpo
410: Return,rc
411: }
Regards,
burque505
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
I think it is chromedriver error.
You have to download and run version of chromedriver that is needed for Your browser version.
You have to download and run version of chromedriver that is needed for Your browser version.
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
I don't think that's it. I'm using the same version (for Chrome 83) that I use for SeleniumBasic and all my Python-based scripts. They all work.
Regards,
burque505
Regards,
burque505
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
Try like this:
Code: Select all
wd := new WDSession("http://127.0.0.1:4444/")
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
Thanks, that works! Here's the whole script case it helps someone else.
Unless I run the driver first it fails. This is the code in the example:
EDIT: Can't get Chrome to work yet, though. Trying to work my way through this post.. It appears that since version 63 you can't specify the remote debugging port as an argument, just as an option.
Regards,
burque505
Code: Select all
;#noenv
#include AHKWebDriver.ahk
#include json.ahk
Run, %A_ScriptDir%\geckodriver.exe
wd := new WDSession("http://127.0.0.1:4444/")
if(wd.rc.isError){
msgbox % "Error:" wd.rc.value.error " " wd.rc.value.message
ExitApp
}
wd.url("https://autohotkey.com")
wd.debug()
; next force error
wd.url("ixbxm.com")
wd.debug()
wd.delete
Spoiler
I appreciate the help, @malcev! EDIT: Can't get Chrome to work yet, though. Trying to work my way through this post.. It appears that since version 63 you can't specify the remote debugging port as an argument, just as an option.
Regards,
burque505
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
If You look at the end of AHKWebDriver.ahk You will see how to set debugging port in Chrome.
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
Thanks, I assume you mean this, which I have seen. However, I don't know whether i have to incorporate this JSON into a script, or how to call it if I do, or whether I have to modify AHKWebDriver.ahk.
Regards,
burque505
Spoiler
I can retrieve the needed information, I think:
Code: Select all
ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416})
burque505
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
You just have to send it.
For example open window 1000x800 json can be like this:
For example open window 1000x800 json can be like this:
Code: Select all
options = {"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"args":["window-size=1000,800"]}}}}
wd := new WDSession(, options)
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
Thank you for your efforts to help me, but I'm still completely lost. The code you provided has no context I can work from other than it's right before wd := new WDSession(, options).
By the time the script reaches that, chromedriver is already executing and has randomly selected a port to listen to.
I need to get the option information to chrome somehow.
A script that works, with no code left out, would be extremely helpful.
Regards,
burque505
By the time the script reaches that, chromedriver is already executing and has randomly selected a port to listen to.
I need to get the option information to chrome somehow.
A script that works, with no code left out, would be extremely helpful.
Regards,
burque505
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
I do not understand what do You want.
You asked:
You asked:
I wrote examle how to send options with json.It appears that since version 63 you can't specify the remote debugging port as an argument, just as an option
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
I would like to have a working script using Chrome and AHKWebDriver.ahk.
Code you provided did not work for me with Chrome, I get the same errors as before.
Thanks anyway.
Regards,
burque505
Code you provided did not work for me with Chrome, I get the same errors as before.
Thanks anyway.
Regards,
burque505
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
If You need to change port in options, You have to change json like this.
Code: Select all
options = {"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"args":["remote-debugging-port=9222"]}}}}
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
Same results, I'm giving up on AHKWebDriver.ahk, thanks for your efforts.
Perhaps one day someone will post a working script using Chrome.
Regards,
burque505
Perhaps one day someone will post a working script using Chrome.
Regards,
burque505
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
For me it works without setting options.
If I run chromedriver on specific port like this
Then I can connect with this code
If I run chromedriver on specific port like this
Code: Select all
C:\temp\chromedriver.exe --port=1234
Code: Select all
wd := new WDSession("http://127.0.0.1:1234/")
Re: RPAChallenge with AHK, COM, and JSWrapper.ahk
No luck.
I don't see how that could possibly work.Code: Select all
#include AHKWebDriver.ahk
#include json.ahk
Run, %A_ScriptDir%\chromedriver.exe --port=1234
wd := new WDSession("http://127.0.0.1:1234/")
if(wd.rc.isError){
msgbox % "Error:" wd.rc.value.error " " wd.rc.value.message
ExitApp
}
wd.url("https://autohotkey.com/")
wd.debug()
; next force error
wd.url("ixbxm.com")
wd.debug()
wd.delete
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: jacek678 and 227 guests