Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 11 Oct 2018, 15:36
by Xtra
SeleniumBasic is a Visual Basic selenium wrapper program providing the COM interface method that AHK uses to control it.
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 29 Oct 2018, 21:08
by jeeswg
- I wrote a script to get the webpage titles/urls in Chrome v69.
- Some issues: it doesn't know how many tabs there are, the order is unspecified, it activates each tab (although very quickly).
- If anyone can improve this, I would be grateful.
- Btw is anyone having any success with Firefox and SeleniumBasic? It says here that people have to downgrade to Firefox v46.0.1 to use it with SeleniumBasic.
FireFox, Chrome, Edge, Opera Drivers are not working · Issue #133 · florentbr/SeleniumBasic · GitHub https://github.com/florentbr/SeleniumBasic/issues/133
- Also, it looks like there has been no activity since Mar 2, 2016.
Release SeleniumBasic v2.0.9.0 · florentbr/SeleniumBasic · GitHub https://github.com/florentbr/SeleniumBa ... g/v2.0.9.0
Re: Using Selenium with AutoHotkey- Cross browser automation!
A I know it is impossible to get info from tab without activating it using selenium.
the order is unspecified
The order does not depend on position order, but depends from switch order.
For example if You switch 1-2-3, tab index of number 3 will be 1 and number 1 will be 3.
As a workaround You can compare each tab position through iaccessible interface.
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 12 Nov 2018, 17:44
by shipaddicted
I just started messing with this Selenium stuff last night. So far, it works great. I'm hoping I'll be allowed to use it on my work computer to automate a bunch of the useless crap we have to go through to complete the simplest of tasks. Anyhow, I'm trying to mash up a couple of scripts from earlier in this thread and I'm having a little trouble getting what I want. When I run this, I want it to first look and see if I already have Chrome open, and if so, use the existing window. If Chrome is not currently running, run it and go to the site I need. This is what I have:
If I already have Chrome running, it works okay -- it goes to my most recently tab and opens the new url there (which is not really ideal -- I'd rather open a new tab in most cases, but I'll deal with that part later). But if I don't have Chrome running yet, nothing happens. If I manually open Chrome after trying to run the script, the script will pick up at that point and hijack a tab.
I have tried every version of the if/else statement above I can think of -- If !WinExist, switching the order of the statements, only having one of the statements (If but no else).
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 12 Nov 2018, 17:47
by shipaddicted
Immediately after posting I thought of another thing to try -- IfWinNotExist -- which worked. I wasn't going to bother with it since the documentation said it's deprecated, but Win[Not]Exist() didn't work either, so I thought, why not?
So now I at least have this functioning pretty well:
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 02 Dec 2018, 14:35
by Ceruleancerise
Hi,
I've been following along with Joe Glines' tutorial and have installed SeleniumBasic and chromedriver under Joe's direction and have them under /Program Files/.
However, when I try to run a test script to launch chrome (See: https://p.ahkscript.org/?p=c9351c88) I get an error on line 4 that states "The system cannot find the file specified"
Why is this? Have I missed something? Thanks!
Re: Using Selenium with AutoHotkey- Cross browser automation!
#SingleInstance, Force
Del::
driver := ComObjCreate("Selenium.ChromeDriver") ; Start with Chrome
driver.Get("http://duckduckgo.com/") ; Navigate to a webpage
MsgBox here
return
Re: Using Selenium with AutoHotkey- Cross browser automation!
#SingleInstance, Force
Del::
driver := ComObjCreate("Selenium.ChromeDriver") ; Start with Chrome
driver.Get("http://duckduckgo.com/") ; Navigate to a webpage
MsgBox here
return
same result :/
Re: Using Selenium with AutoHotkey- Cross browser automation!
driver:= ComObjCreate("Selenium.CHROMEDriver") ;Chrome driver
driver.Get("http://the-automator.com")
;********************find and click text***********************************
keyword:="Continue reading" ; keyword you want to find- Note Case sensitive
if(driver.FindElementByXPath("//*[text() = '" keyword "']"))
driver.FindElementByXPath("//*[text() = '" keyword "']").click()
Hello dear Joe Glines.
Sir, I am trying to automate chrome by selenium and i want to get the URL from a button or link in a webpage. I am unable to retrieve the URL from a specific button or link in a webpage. For this i have asked a question in AutoHotKey help form. The link of my question is this-
The trick is to always start at the base document and switch to the next frame and then the next (if needed) you can not jump over iframes/frames.
Imagine a tree that you have to go from the trunk and up every branch to your destination but you cant jump across branches,
When you want to go back to the base document use:
The trick is to always start at the base document and switch to the next frame and then the next (if needed) you can not jump over iframes/frames.
Imagine a tree that you have to go from the trunk and up every branch to your destination but you cant jump across branches,
When you want to go back to the base document use:
Thank you very much. The iframe doesn't have a name but it is the only iframe in the page. I use driver.SwitchToFrame(0) to switch to the frame and it works. Thanks.
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 11 Jul 2019, 02:29
by warwickc
Hi
Loving Selenium, know I've learnt xPath it's really powerful. Joe, your tutorials have been fantastic help over a very long night!
Couple of questions
How do you handle Pop-Up Alerts. I've seen this:
but think thats java as it doesnt work in AHK, and I cant find the corresponding command to use in AHK.
Also, can you set an implicit wait. Again, according to https www.guru99.com /implicit-explicit-waits-selenium.html Broken Link for safety it should look like
Any help much appreciated - my project is nearly there but it keeps timing out, and I cant deal with those pop ups!
W
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 11 Jul 2019, 07:40
by malcev
Just search Seleniumbasic manual for your commands.
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 12 Jul 2019, 16:56
by mikea105
I normally use an explicit wait. The syntax below seems to work fine with Autohotkey and Selenium. This line waits up to 30 seconds for the element to appear and be clickable. Hopefully it will work for you.
myDynamicElement := (new WebDriverWait(driver, 30)).until(ExpectedConditions.elementToBeClickable(driver.executeScript("document.getElementById('ScanButton')")))
Re: Using Selenium with AutoHotkey- Cross browser automation!
Posted: 24 Sep 2019, 15:53
by AHK_user
I was trying to open a new tab, but the popup blocker blocks it.
I tried adding the disable-popup-blocking, but without succes.
Does anybody knows how to disable the popup blocking?