Basic Webdriver Test using Python

”’
Created on Feb 26, 2017

@author: asharda
”’

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

#driver = webdriver.Firefox(executable_path=r’C:\Users\asharda\Downloads\geckodriver-v0.14.0-win64\geckodriver.exe’)
driver = webdriver.Chrome(executable_path=r’C:\Users\asharda\Downloads\chromedriver_win32\chromedriver.exe’)
#driver.get(“http://www.google.com”)
driver.get(“http://www.python.org”)
assert “Python” in driver.title
elem = driver.find_element_by_name(“q”)
elem.clear()
elem.send_keys(“ashish”)
elem.send_keys(Keys.RETURN)
assert “No results found.” not in driver.page_source
driver.close()

Advertisements

About qainterviews

Software Geek,QA Expert,Blogger
This entry was posted in Python, Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s