Python Forum
open a web page by selenium !! - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: open a web page by selenium !! (/thread-11884.html)



open a web page by selenium !! - evilcode1 - Jul-30-2018

hello folks ... i hope all okay ?

i try to visit a website via selenium but it did not work :

from selenium import webdriver
qassam = "http://ign.com"

dev = webdriver.Firefox()

dev.get(qassam)
it just open my browser not visited the website ??
and is there anyway to hide the browser ?


ps: my os is Linux evilcode1 4.4.0-130-generic #156~14.04.1-Ubuntu SMP Thu Jun 14 13:51:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


RE: open a web page by selenium !! - Larz60+ - Jul-30-2018

Use the headless option, see: https://python-forum.io/Thread-Web-scraping-part-2?highlight=selenium


RE: open a web page by selenium !! - evilcode1 - Aug-01-2018

(Jul-30-2018, 10:58 AM)Larz60+ Wrote: Use the headless option, see: https://python-forum.io/Thread-Web-scraping-part-2?highlight=selenium
not working when i run the code its juts open my browser without doing anything


RE: open a web page by selenium !! - snippsat - Aug-01-2018

That's the old way webdriver.Firefox() Firefox has messed it up some with DesiredCapabilities
And marionette can be True or False based on Firefox version.
This work for me,this setup is also in link over in my tutorial.
Now do i have geckodriver is folder as scripts.
from selenium import webdriver

#-- FireFox
caps = webdriver.DesiredCapabilities().FIREFOX
caps["marionette"] = True
browser = webdriver.Firefox(capabilities=caps)
url = "http://ign.com"
browser.get(url)
Chrome is easier.
from selenium import webdriver

#-- Chrome
browser = webdriver.Chrome()
url = "http://ign.com"
browser.get(url)