Using Selenium with AutoHotkey- Cross browser automation!

Helpful script writing tricks and HowTo's
burque505
Posts: 1063
Joined: 22 Jan 2017, 19:37

Re: Using Selenium with AutoHotkey- Cross browser automation!

25 Oct 2019, 13:16

@malcev, thanks for the clarification.
burque505
Posts: 1063
Joined: 22 Jan 2017, 19:37

Re: Using Selenium with AutoHotkey- Cross browser automation!

25 Oct 2019, 13:37

Thanks, malcev. As others have complained of on StackOverflow, the supplied SeleniumBasic.chm file is corrupt. I didn't see any other API documentation in the folder.
malcev
Posts: 262
Joined: 12 Aug 2014, 12:37

Re: Using Selenium with AutoHotkey- Cross browser automation!

25 Oct 2019, 13:52

Strange. For me this file works on both systems: Win7 and Win10.
burque505
Posts: 1063
Joined: 22 Jan 2017, 19:37

Re: Using Selenium with AutoHotkey- Cross browser automation!

25 Oct 2019, 14:00

Perhaps it's a question of encoding. I haven't tried with Win10 yet, but I will. Might I ask what codepage your system is?
malcev
Posts: 262
Joined: 12 Aug 2014, 12:37

Re: Using Selenium with AutoHotkey- Cross browser automation!

25 Oct 2019, 14:07

IsSingleByte : True
BodyName : koi8-r
EncodingName : Cyrillic (Windows)
HeaderName : windows-1251
WebName : windows-1251
WindowsCodePage : 1251
IsBrowserDisplay : True
IsBrowserSave : True
IsMailNewsDisplay : True
IsMailNewsSave : True
EncoderFallback : System.Text.InternalEncoderBestFitFallback
DecoderFallback : System.Text.InternalDecoderBestFitFallback
IsReadOnly : True
CodePage : 1251
burque505
Posts: 1063
Joined: 22 Jan 2017, 19:37

Re: Using Selenium with AutoHotkey- Cross browser automation!

25 Oct 2019, 14:14

Большое спасибо! As it turns out, I was able to open it from the command prompt with

Code: Select all

C:\temp> hh Selenium.chm
I don't recall this happening before, that I had to do that, that is. Double-clicking a *.chm file generally opens the file for me. At any rate, thanks again, and the mystery is solved! And the file is very helpful indeed.
Regards,
burque505
daiweisc
Posts: 17
Joined: 19 Oct 2019, 04:27

Re: Using Selenium with AutoHotkey- Cross browser automation!

26 Oct 2019, 04:46

malcev wrote:
25 Oct 2019, 05:52
@gregster, did You ever use selenium wrapper for vba? And if Yes, where did You find this methods: AddExperimentalOption, ChromeOptions?
@daiweisc, preferences You can set with WebDriver.SetPreference Method.
@gregster, thank your reply soon, i will try it on Monday.
@malcev, thank your conclusion, i think it will be simple for use, but i am confused with WebDriver.SetPreference and WebDriver.AddArgument? what is the difference of WebDriver.SetPreference and WebDriver.AddArgument?
euras
Posts: 392
Joined: 05 Nov 2015, 12:56

Re: Using Selenium with AutoHotkey- Cross browser automation!

26 Oct 2019, 14:14

hi, can Selenium be accessed only from Debug mode browser, or can I access the page from the active browser, usin Selenium, no mater what?
daiweisc
Posts: 17
Joined: 19 Oct 2019, 04:27

Re: Using Selenium with AutoHotkey- Cross browser automation!

26 Oct 2019, 19:18

malcev wrote:
26 Oct 2019, 05:27
Preferences:
https chromium.googlesource.com /chromium/src/+/master/chrome/common/pref_names.cc Broken Link for safety
Arguments:
https chromium.googlesource.com /chromium/src/+/master/chrome/common/chrome_switches.cc Broken Link for safety
in Edge and Firefox ,I want to use the function of "ask where to save each file before downloading", just like Chrome code :

Code: Select all

prefs := """download.prompt_for_download"": True"		; or prefs := "'download.prompt_for_download': True"
options.AddExperimentalOption("prefs", prefs)
How to write the code in Edge and Firefox ?
malcev
Posts: 262
Joined: 12 Aug 2014, 12:37

Re: Using Selenium with AutoHotkey- Cross browser automation!

27 Oct 2019, 05:37

@euras, read this topic from the start.
@daiweisc,
1) Code that You provided will not work.
2) Boolean value true in Com is not just "true" or 1, but ComObject(0xB, -1).
3) You can search for Edge and Firefox preferences by Yourself.
daiweisc
Posts: 17
Joined: 19 Oct 2019, 04:27

Re: Using Selenium with AutoHotkey- Cross browser automation!

28 Oct 2019, 02:07

malcev wrote:
27 Oct 2019, 05:37
@euras, read this topic from the start.
@daiweisc,
1) Code that You provided will not work.
2) Boolean value true in Com is not just "true" or 1, but ComObject(0xB, -1).
3) You can search for Edge and Firefox preferences by Yourself.
thanks, i run this code works well

Code: Select all

Driver := ComObjCreate("Selenium.ChromeDriver")           ; Start with Chrome
Driver.SetPreference("download.prompt_for_download", ComObject(0xB, -1))
Driver.AddArgument("--start-maximized")
daiweisc
Posts: 17
Joined: 19 Oct 2019, 04:27

Re: Using Selenium with AutoHotkey- Cross browser automation!

28 Oct 2019, 22:05

i automate the web hover menu with selenium.
the code is :

Code: Select all

Driver.FindElementByCSS("#divMenu > ul > li:nth-child(7) > a").ClickAndHold()
Sleep,500
Driver.FindElementByCSS("#divMenu > ul > li:nth-child(7) > ul > li:nth-child(1) > a").Click()
Sleep,1000
sometimes the code does work, sometimes works wrong. this make me confused. Who can help me?
the wrong is missing element.
daiweisc
Posts: 17
Joined: 19 Oct 2019, 04:27

Re: Using Selenium with AutoHotkey- Cross browser automation!

29 Oct 2019, 03:14

Sir Teddy the First wrote:
06 Oct 2019, 03:05
@Xtra
I'm using Microsoft Edge (EdgeHTML) version 18 and thats the problem because you can only download the drivers up to version 17, version 18 needs to be installed through the command window so I don't get an .exe-file that I could copy to the SeleniumBasic Folder.
That is my problem.

I already tried downloading the version 17 file. The .exe-file can be started without a problem but when trying to access that driver via AHK I still get a timeout message.
I can not use Edge well,how do you access the driver via AHK. I downloads the Edge WebDriver and copy it to the SeleniumBasic Folder. But it does not work.
chngrcn
Posts: 147
Joined: 29 Feb 2016, 08:55

Re: Using Selenium with AutoHotkey- Cross browser automation!

11 Nov 2019, 02:10

Code: Select all

<a href="javascript:void(0)" data-id="26b60b16-f60b-4ea0-b439-2bbc5bd6dc08" data-what="getEgmPlakaQ" class="btn btn-dark"><i class="fa fa-spinner" aria-hidden="true"></i> Detail</a>
I would like to click the button named "Detail" in the html code above. but the following code doesn't work.
I use selenium. Can you help me. Thank you.

Code: Select all

driver.executeScript("return document.all('26b60b16-f60b-4ea0-b439-2bbc5bd6dc08').click()")
this code does not work. somehow failed!


https://imgyukle.com/i/ekran-alintisi.Ew2qoH

Can you help me. Thank you.

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 13 guests