From ec9ef7392016095702ae2aeab153220d5256dc98 Mon Sep 17 00:00:00 2001 From: Bryan Date: Thu, 27 Feb 2025 19:58:53 -0600 Subject: [PATCH 1/3] Update search script --- sample_script.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sample_script.py b/sample_script.py index 3925e9462..6b254a56d 100755 --- a/sample_script.py +++ b/sample_script.py @@ -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) @@ -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() From 2c55ac4930a4aa3ef52ad5cbaa30dfd9a9635053 Mon Sep 17 00:00:00 2001 From: Bryan F Date: Tue, 11 Mar 2025 19:49:54 -0500 Subject: [PATCH 2/3] homeworklesson 2 --- Homework Lesson 2 complete.py | 50 +++++++++++++++++++++++++++++++++++ locator.py | 0 2 files changed, 50 insertions(+) create mode 100644 Homework Lesson 2 complete.py create mode 100644 locator.py diff --git a/Homework Lesson 2 complete.py b/Homework Lesson 2 complete.py new file mode 100644 index 000000000..1ca6e9db6 --- /dev/null +++ b/Homework Lesson 2 complete.py @@ -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'] + + + + + + + diff --git a/locator.py b/locator.py new file mode 100644 index 000000000..e69de29bb From 768b49c99564d8bc24eebc793106e473aa9ad765 Mon Sep 17 00:00:00 2001 From: Bryan F Date: Tue, 11 Mar 2025 20:06:50 -0500 Subject: [PATCH 3/3] BRYANFIELDS.TXT --- BryanFields.txt | 1 + Homework Lesson 2.py | 50 ++++++++++++++++++++++++++++++++++++++++++++ locator.py | 23 ++++++++++++++++++++ sample_script.py | 2 +- 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 BryanFields.txt create mode 100644 Homework Lesson 2.py diff --git a/BryanFields.txt b/BryanFields.txt new file mode 100644 index 000000000..9c9162e53 --- /dev/null +++ b/BryanFields.txt @@ -0,0 +1 @@ +Bryan Fields this is my commit diff --git a/Homework Lesson 2.py b/Homework Lesson 2.py new file mode 100644 index 000000000..1ca6e9db6 --- /dev/null +++ b/Homework Lesson 2.py @@ -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'] + + + + + + + diff --git a/locator.py b/locator.py index e69de29bb..f10386fc3 100644 --- a/locator.py +++ b/locator.py @@ -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') + + + diff --git a/sample_script.py b/sample_script.py index 6b254a56d..8610692ef 100755 --- a/sample_script.py +++ b/sample_script.py @@ -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()