Using Selenium with AutoHotkey- Cross browser automation!
Re: Using Selenium with AutoHotkey- Cross browser automation!
@malcev, thanks for the clarification.
Re: Using Selenium with AutoHotkey- Cross browser automation!
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.
Re: Using Selenium with AutoHotkey- Cross browser automation!
Strange. For me this file works on both systems: Win7 and Win10.
Re: Using Selenium with AutoHotkey- Cross browser automation!
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?
Re: Using Selenium with AutoHotkey- Cross browser automation!
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
Re: Using Selenium with AutoHotkey- Cross browser automation!
Большое спасибо! As it turns out, I was able to open it from the command prompt with 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
Code: Select all
C:\temp> hh Selenium.chm
Regards,
burque505
Re: Using Selenium with AutoHotkey- Cross browser automation!
@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?
Re: Using Selenium with AutoHotkey- Cross browser automation!
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?
Re: Using Selenium with AutoHotkey- Cross browser automation!
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)
Re: Using Selenium with AutoHotkey- Cross browser automation!
@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,
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.
Re: Using Selenium with AutoHotkey- Cross browser automation!
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")
Re: Using Selenium with AutoHotkey- Cross browser automation!
i automate the web hover menu with selenium.
the code is :
sometimes the code does work, sometimes works wrong. this make me confused. Who can help me?
the wrong is missing element.
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
the wrong is missing element.
Re: Using Selenium with AutoHotkey- Cross browser automation!
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.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.
Re: Using Selenium with AutoHotkey- Cross browser automation!
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 use selenium. Can you help me. Thank you.
Code: Select all
driver.executeScript("return document.all('26b60b16-f60b-4ea0-b439-2bbc5bd6dc08').click()")
https://imgyukle.com/i/ekran-alintisi.Ew2qoH
Can you help me. Thank you.
Re: Using Selenium with AutoHotkey- Cross browser automation!
Hi why is there need for .NET Framework 3.5?
I have 4.0 and above, and no admin rights for instalation, how to solve this?
I have 4.0 and above, and no admin rights for instalation, how to solve this?
Re: Using Selenium with AutoHotkey- Cross browser automation!
How to Translate this:
Select oSelect = new Select(driver.findElement(By.id("yy_date_8")));
oSelect.selectByVisibleText("2010");
to autohotkey to use with Selenium.
this code is for select a element from a listview
Thanks.
Select oSelect = new Select(driver.findElement(By.id("yy_date_8")));
oSelect.selectByVisibleText("2010");
to autohotkey to use with Selenium.
this code is for select a element from a listview
Thanks.
Last edited by robo_z on 31 Mar 2020, 18:43, edited 1 time in total.
Re: Using Selenium with AutoHotkey- Cross browser automation!
Search doc for asselect method.
- Thoughtfu1Tux
- Posts: 125
- Joined: 31 May 2018, 23:26
Re: Using Selenium with AutoHotkey- Cross browser automation!
I was playing around with burque505's PDF code that he posted in 2019 and managed to dig up a way to take a screenshot of the page thanks to this wonderful StackOverflow answer: https://stackoverflow.com/questions/60992134/seleniumbasic-vba-takescreenshot-element-outside-of-the-screenshot-error?r=SearchResults
Code: Select all
driver:= ComObjCreate("Selenium.CHROMEDriver") ;Select and Create Chrome driver instance
driver.setbinary("C:\Software\Chromium\chrome.exe") ;Sets path to custom Binary
driver.AddArgument("disable-infobars") ;Hides 'Chrome is being controlled by automated test software' message
driver.AddArgument("--start-maximized") ; Maximize Chrome Browser
driver.AddArgument("--disable-gpu")
;driver.AddArgument("--headless")
driver.get("https://www.startpage.com")
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
;driver.Window.Maximize ; Maximize the window, not really necessary as chrome starts that way by default
savepath = C:\Users\%A_UserName%\Downloads\StartpageScreenshot.png
driver.TakeScreenshot().SaveAs(savepath)
run, %savepath% ; Open screenshot
Msgbox, Screenshot taken!
ExitApp
Re: Using Selenium with AutoHotkey- Cross browser automation!
Thanks, @Thoughtfu1Tux! Here's a version using SChrome_Get by @AHK_User with credits to @tmplinshi, @CH HAN and @Joe Glines.
EDIT: Seems to work fine like this as well.
RE-EDIT:
This scrolls the nav footer into view before taking the screenshot.
Regards,
burque505
Code: Select all
#Include SChrome_Get.ahk
driver := SChrome_Get("https://chromium.woolyss.com/")
driver.AddArgument("disable-infobars") ;Hides 'Chrome is being controlled by automated test software' message
driver.AddArgument("--start-maximized") ; Maximize Chrome Browser
driver.AddArgument("--disable-gpu")
;driver.AddArgument("--headless")
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
;driver.Window.Maximize ; Maximize the window, not really necessary as chrome starts that way by default
savepath = %A_ScriptDir%\ChromiumScreenshot.png
driver.TakeScreenshot().SaveAs(savepath)
run, %savepath% ; Open screenshot
Msgbox, Screenshot taken!
ExitApp
Code: Select all
#Include SChrome_Get.ahk
driver := SChrome_Get("https://chromium.woolyss.com/")
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
;driver.Window.Maximize ; Maximize the window, not really necessary as chrome starts that way by default
savepath = %A_ScriptDir%\ChromiumScreenshot.png
driver.TakeScreenshot().SaveAs(savepath)
run, %savepath% ; Open screenshot
Msgbox, Screenshot taken!
ExitApp
This scrolls the nav footer into view before taking the screenshot.
Code: Select all
#Include SChrome_Get.ahk
driver := SChrome_Get("https://www.amazon.com/")
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
driver.FindElementById("navFooter").ScrollIntoView()
;driver.Window.Maximize ; Maximize the window, not really necessary as chrome starts that way by default
savepath = %A_ScriptDir%\ChromiumScreenshot.png
driver.TakeScreenshot().SaveAs(savepath)
run, %savepath% ; Open screenshot
Msgbox, Screenshot taken!
ExitApp
burque505