Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to let browser to assigned web
#1
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,
Reply
#2
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.
Reply
#3
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()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  webdriver.remote to connect back existing browser without open new browser? gahhon 6 6,628 Feb-26-2019, 03:53 PM
Last Post: gahhon

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020