driver:= ComObjCreate("Selenium.CHROMEDriver") ;Chrome driver
driver.Get("https://www.google.com/")
; Put a keyword 'AutoHotkey' in a blank
Xpath = //*[@id="lst-ib"]
driver.FindElementByXPath(Xpath).SendKeys("AutoHotkey")
driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.Enter)
MsgBox
; Open AutoHotkey web page
Xpath = //*[@id="rso"]/div[1]/div/div/div/div/h3/a
driver.FindElementByXPath(Xpath).click()
MsgBox
If you want to make your own customized Xpaths, you should check a video below.
wb := IEGet("My Drive - Google Drive - Internet Explorer")
; everything is not working
/*
wb.document.getElementsByTagName("SPAN")[84].focus()
Send, {AppsKey}
Send, {Down}
Send, {Down}
Send, {Enter}
*/
;~ wb.document.getElementsByTagName("SPAN")[84].click(Right)
;~ wb.document.getElementsByTagName("SPAN")[84].rightclick()
MsgBox
I've searched many times and many web pages to figure out ways to click mouse right button on Chrome but I couldn't find any ways. I think I should learn Java and run Selenium on it.
Does anybody know any ways to open right-click menu and select one of elements of the menu on Chrome using Selenium~?!?!
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 02 Dec 2017, 19:57
by Joe Glines
I wouldn't try and send mouse-clicks. Are the actions you want taken available from the HTML on the element? Typically they are a you can just trigger the proper event (or load the proper url, etc)
Re: Using Selenium with AutoHotkey- Cross browser automation!
First Msgbox code line returns only a value which first founded and the 2nd has an error. I'd like to get 2nd, 3rd, and more value which contains the text. Anybody has any ideas?
Re: Using Selenium with AutoHotkey- Cross browser automation!
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 16 Dec 2017, 01:42
by CH HAN
I've found the answer of the question I posted above, it's using brackets. If you want use elements sharing same Xpath, you should add brackets end of Xpath like (Xpath)[2] or (Xpath)[3]
driver.executeScript("return document.readyState").equals("complete") ; wait until page loads
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 16 Dec 2017, 07:25
by Joe Glines
@CH HAN - Sorry I didn't see your previous question about accessing the other words. yes, adding brackets will access the items as an array. If I remember correctly, in Selenium, they are not zero based (unlike in COM where they are).
Regarding the page loading- Have you had issues with Selenium moving forward before the page fully loaded? In my experimenting I didn't have that issue...
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 14 Jan 2018, 04:10
by CH HAN
@Joe Glines
Sorry for the late reply, I've not touched Selenium for long time. The answer is Yes. Sometimes Selenium just continues codes even while browser is still loading a page so I change the waiting code like the below but it still not works perfectly either.
driver:= ComObjCreate("Selenium.CHROMEDriver") ;Chrome driver
driver.AddArgument("disable-infobars") ; Close Message that 'Chrome is being controlled by automated test software'
driver.AddArgument("--start-maximized") ; Maximize Chrome Browser
driver.Get("http://duckduckgo.com/")
driver.ExecuteScript("document.body.style.zoom = '100%';") ; Set the font of Chrome browser to 100%
However, these are not working for Chrome browsers controlled by ChromeGet() function.
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 16 Feb 2018, 07:02
by Joe Glines
Just curious if anyone on this thread has tried GeekDude's solution for automating Chrome w/o Selenium. I worked on some functions to use with it for setting/getting data but haven't had time to finish them up and share.
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 08 Jun 2018, 10:47
by flatwater
Thank you for the tutorials.
How do I hide the chrome window? Thanks.
Re: Using Selenium with AutoHotkey- Cross browser automation!