Python Forum

Full Version: How to let browser to assigned web
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I want to my chrome browser to assigned web
but chrome browser just show  frontpage of browser

The code was this...

   from selenium import webdriver

   browser = webdriver.Chrome("C:\Program Files\Google\Chrome\Application\Chrome.exe")
   browser.get('web url')
I was hoping for some guidance or advice really. Somewhere I can start from to solve the problem and answer the questions.

Thanks,
Have you looked at the documentation http://www.seleniumhq.org/docs/03_webdriver.jsp?

That document suggests that you use Maven to test and has other info you may need.
Have you give web_url a variable?
So this open the Python website.
from selenium import webdriver

browser = webdriver.Chrome()
web_url = 'https://www.python.org/'
browser.get(web_url)
Selenium is used for testing websites or web-scraping.
So here it will click on documentation tab and click on tutorial link.
from selenium import webdriver
import time

browser = webdriver.Chrome()
web_url = 'https://www.python.org/'
browser.get(web_url)
time.sleep(2)
browser.find_element_by_css_selector('#top > nav > ul > li.docs-meta > a').click()
time.sleep(2)
browser.find_elements_by_xpath('html/body/div[2]/div[1]/div/div/table[1]/tbody/tr/td[1]/p[2]/a')[0].click()