Skip to content

bryan pull request #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BryanFields.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bryan Fields this is my commit
50 changes: 50 additions & 0 deletions Homework Lesson 2 complete.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#Amazon logo
#Search Strategy by class name
//img[@alt='Amazon']


#Email field
#Search Strategy: by ID
//input[@id='ap_email']


#Continue button
#Search Strategy: by name and id or I could find it by the button text
//input[@id='continue']


#Conditions of use link
#Search Strategy: by locating the link text
//a[text()='Conditions of Use']


#Privacy Notice link
#Search Strategy: by text link
//a[text()='Privacy Notice']


#Need help link
#Search Strategy: by link text
//a[text()='Need help?']


#Forgot your password link
#Search Strategy: by locating the link text
//a[text()='Forgot your password?']


#Other issues with Sign-In link
#Search Strategy: by locating the link text
//a[text()='Other issues with Sign-In']


#Create your Amazon account button
#Search Strategy: by locating the link text
//a[text()='Create your Amazon account']







50 changes: 50 additions & 0 deletions Homework Lesson 2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#Amazon logo
#Search Strategy by class name
//img[@alt='Amazon']


#Email field
#Search Strategy: by ID
//input[@id='ap_email']


#Continue button
#Search Strategy: by name and id or I could find it by the button text
//input[@id='continue']


#Conditions of use link
#Search Strategy: by locating the link text
//a[text()='Conditions of Use']


#Privacy Notice link
#Search Strategy: by text link
//a[text()='Privacy Notice']


#Need help link
#Search Strategy: by link text
//a[text()='Need help?']


#Forgot your password link
#Search Strategy: by locating the link text
//a[text()='Forgot your password?']


#Other issues with Sign-In link
#Search Strategy: by locating the link text
//a[text()='Other issues with Sign-In']


#Create your Amazon account button
#Search Strategy: by locating the link text
//a[text()='Create your Amazon account']







23 changes: 23 additions & 0 deletions locator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from time import sleep
##
# get the path to the ChromeDriver executable
driver_path = ChromeDriverManager().install()

# create a new Chrome browser instancegit
service = Service(driver_path)
driver = webdriver.Chrome(service=service)
driver.maximize_window()

# open the url
driver.get('https://www.amazon.com/')

# By ID
driver.find_element(By.ID, 'twotabsearchtextbox')
driver.find_element(By.ID, 'nav-search-submit-button')



6 changes: 3 additions & 3 deletions sample_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# get the path to the ChromeDriver executable
driver_path = ChromeDriverManager().install()

# create a new Chrome browser instance
# create a new Chrome browser instancegit
service = Service(driver_path)
driver = webdriver.Chrome(service=service)
driver.maximize_window()
Expand All @@ -18,7 +18,7 @@
# populate search field
search = driver.find_element(By.NAME, 'q')
search.clear()
search.send_keys('Car')
search.send_keys('Bryan')

# wait for 4 sec
sleep(4)
Expand All @@ -27,7 +27,7 @@
driver.find_element(By.NAME, 'btnK').click()

# verify search results
assert 'car'.lower() in driver.current_url.lower(), f"Expected query not in {driver.current_url.lower()}"
assert 'Bryan'.lower() in driver.current_url.lower(), f"Expected query not in {driver.current_url.lower()}"
print('Test Passed')

driver.quit()