forked from careerist-qa/python-selenium-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathamazon_locators_CSS_L03.py
More file actions
39 lines (35 loc) · 1.61 KB
/
Copy pathamazon_locators_CSS_L03.py
File metadata and controls
39 lines (35 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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 instance
service = Service(driver_path)
driver = webdriver.Chrome()
driver.maximize_window()
# open the url
driver.('https://www.amazon.com/')
#Logo on Create Amazon Account Page
driver.find_element(By.CSS_SELECTOR, ".a-icon-logo")
#Find text 'Create Account'
driver.find_element(By.CSS_SELECTOR, "h1.a-spacing-small")
#Find entry box 'Your Name'
driver.find_element(By.CSS_SELECTOR, "input#ap_customer_name")
#Find entry box 'Email'
driver.find_element(By.CSS_SELECTOR, "input#ap_email")
#Find entry box 'Password'
driver.find_element(By.CSS_SELECTOR, "input#ap_password")
#Find 'Password must be at least 6 characters'
driver.find_element(By.CSS_SELECTOR, "[id='ap_password_context_message_section'git]")
#Find entry box 'Re-enter Password'
driver.find_element(By.CSS_SELECTOR, "input#ap_password_check")
#Find button 'Create your Amazon account' or 'Continue'
driver.find_element(By.CSS_SELECTOR, "input#continue.a-button-input")
#Find link 'Conditions of Use' $$("#legalTextRow [href*='ap_register_notification_condition_of_use']")
driver.find_element(By.CSS_SELECTOR, "#legalTextRow [href*='condition_of_use']")
#Find link 'Privacy Notice'
driver.find_element(By.CSS_SELECTOR, "[href*='ap_register_notification_privacy_notice']")
#Find link 'Sign in'
driver.find_element(By.CSS_SELECTOR, ".a-link-emphasis")