0

I'm very new to Selenium Web Browser Automation. I'm trying to write a test to verify a that the menu item for About actually goes to the About page in "http://www.seleniumhq.org/" Do you guys have an idea of how to achieve this by using Selenium Web Browser Automation Python?? Thanks you!

2 Answers 2

1

Locate the About link by link text, click it and check what the value of driver.title is:

from selenium import webdriver


driver = webdriver.Firefox()
driver.get("http://www.seleniumhq.org/")

driver.find_element_by_link_text("About").click()

assert driver.title == "About Selenium"

driver.close()
Sign up to request clarification or add additional context in comments.

Comments

0

First, determine what(element,text,link,img etc) in the loaded about page you will use to validate that you are in correct(about) page. Then construct your code like this-

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome()

driver.implicitly_wait(10)
driver.set_page_load_timeout(10)
driver.get("http://www.seleniumhq.org")
driver.find_element_by_id("menu_about").click()
#Assertion 1
assert 'About' in driver.title
#Assertion 2
assert 'about' in driver.current_url
#console log
print('Title of the current page is: ' + driver.title)
print('Current URL is : ' + driver.current_url)
driver.close()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.