Using Selenium with AutoHotkey- Cross browser automation!

Helpful script writing tricks and HowTo's
User avatar
Thoughtfu1Tux
Posts: 102
Joined: 31 May 2018, 23:26

Re: Using Selenium with AutoHotkey- Cross browser automation!

Post by Thoughtfu1Tux » 18 Jun 2020, 15:04

@burque505
Looks like you've got this Chrome Selenium thing figured out! Do you by any chance have a fix for the "Chrome is being controlled by automated test software" popup that shows up everytime i use chrome to start selenium on the newest chrome versions?

Code: Select all

driver.AddArgument("disable-infobars") ; Close Message that 'Chrome is being controlled by automated test software'
Works fine on Chrome 72, which i'm still using, but it doesn't work on the newest chrome version. This is the only thing that's holding me back from updating.

burque505
Posts: 1358
Joined: 22 Jan 2017, 19:37

Re: Using Selenium with AutoHotkey- Cross browser automation!

Post by burque505 » 18 Jun 2020, 15:27

Hi, @Thoughtfu1Tux, I'm running Chrome 83 at the moment. I'm either not getting that "Chrome is being controlled by automated test software" popup at all or it's going by too fast to see.
There's lots of stuff going on here I haven't even scratched the surface of yet. Check this out:

Code: Select all

#Include SChrome_Get.ahk
driver := SChrome_Get("https://www.startpage.com/")
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
driver.FindElementById("q").ScrollIntoView()
;driver.Window.Maximize	; Maximize the window, not really necessary as chrome starts that way by default
element := SChrome_GetElement(Driver, "q")
SChrome_SendKey(element, "AutoHotkey")
SChrome_SendKey(Driver, "Enter")
ExitApp
Regards,
burque505

User avatar
Thoughtfu1Tux
Posts: 102
Joined: 31 May 2018, 23:26

Re: Using Selenium with AutoHotkey- Cross browser automation!

Post by Thoughtfu1Tux » 26 Jun 2020, 18:52

@burque505
Awesome stuff! Thank you for sharing.
I spent a couple hours playing around with your SChrome_Get function and i'm really liking it! I'm working on transferring my selenium scripts to use it now. If you have any other sample scripts that you haven't shared in this thread before, I'd love to see them! :D

burque505
Posts: 1358
Joined: 22 Jan 2017, 19:37

Re: Using Selenium with AutoHotkey- Cross browser automation!

Post by burque505 » 27 Jun 2020, 07:17

Hi @Thoughtfu1Tux, here's the link for SChromeGet for others - it isn't my script by any means. I'm glad you're having good luck with it.
Regards,
burque505

malcev
Posts: 660
Joined: 12 Aug 2014, 12:37

Re: Using Selenium with AutoHotkey- Cross browser automation!

Post by malcev » 27 Jun 2020, 10:51

By the way websites can detect when You use selenium.
To prevent it You need to hack chromedriver.
https://stackoverflow.com/questions/33225947/can-a-website-detect-when-you-are-using-selenium-with-chromedriver/41220267#41220267

burque505
Posts: 1358
Joined: 22 Jan 2017, 19:37

Re: Using Selenium with AutoHotkey- Cross browser automation!

Post by burque505 » 27 Jun 2020, 10:54

Very interesting, @malcev, thank you.
Regards,
burque505

Post Reply

Return to “Tutorials”