HtmlUnit with python / hide Firefox

1,890 views
Skip to first unread message

Jakob Gillich

unread,
Sep 16, 2011, 5:30:28 AM9/16/11
to seleniu...@googlegroups.com
I'm currently writing an Application for automating a website. Not for testing, just automating, lets call it a bot. I've decided to use selenium because i need something that isn't detectable as a automated Tool.

Now i have 2 Questions:

First: How to use the HtmlUnit Driver with python?
But its unanswered.

Second: Only if theres currently not a way to use the HtmlUnit Driver with the python bindings, if there is one ignore this.
Is there a way to hide the Browser window(firefox)? I've noticed that if i take the focus to another window the form filling fails.
But the firefox window disturbes. I'm using Archlinux/GNOME 3 but it would be the best if there is a cross-platform solution.

Thanks.

Regards
Jakob Gillich

Luke Inman-Semerau

unread,
Sep 20, 2011, 2:25:31 PM9/20/11
to seleniu...@googlegroups.com
To use python with htmlunitdriver you need to start up the standalone server

java -jar selenium-server-standalone-2.6.0.jar

and connect to it with the Remote:

from selenium import webdriver
driver = webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.HTMLUNIT)

or with javascript enabled:

driver = webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.HTMLUNITWITHJS)


bonus (answering your second question): 

you can install xvfb (or xvnc) and have the display for firefox sent to it (making it "hidden") and stop stealing your active desktops focus.


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/9H2MysX0dZwJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

Reply all
Reply to author
Forward
0 new messages