2
votes

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

2

2 Answers

3
votes

PyVirtualDisplay should let you run it in the background.

There's a short walkthough here.

And yes, you can change the User Agent.

1
votes

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.