Kiran
Kiran

Reputation: 8528

Run Firefox in Backend using Selenium webdriver in Python

I am working on a website scraping project using Selenium in Python. I am wondering if I can start the firefox in the backend or open Firefox in another workspace in Ubuntu ?

Is it also possible to pass the user-agent properties though the webdriver() ?

Thanks

Upvotes: 2

Views: 1705

Answers (2)

Tom Christie
Tom Christie

Reputation: 33901

PyVirtualDisplay should let you run it in the background.

There's a short walkthough here.

And yes, you can change the User Agent.

Upvotes: 3

Gustavo Rauber
Gustavo Rauber

Reputation: 110

If you're using Gnome you might want to try DevilsPie (or gDevilsPie) to control on which workspace Firefox runs:

A simple RAW rule would be:

( if 
( begin 
( is ( application_name ) "Firefox" )
) 
( begin 
( set_workspace 3 )
( println "match" )
)
)

I use this with Selenium and it works quite well.

Upvotes: 1

Related Questions