forked from jobeasy-team/python-selenium-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAmazon_Help_Script.py
More file actions
33 lines (22 loc) · 894 Bytes
/
Copy pathAmazon_Help_Script.py
File metadata and controls
33 lines (22 loc) · 894 Bytes
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
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
# init driver
driver = webdriver.Chrome(executable_path='C:\\Users\\usyed\\PycharmProjects\\python-selenium-automation\\chromedriver.exe')
driver.maximize_window()
driver.implicitly_wait(5)
# open the url
driver.get('https://www.amazon.com/gp/help/customer/display.html')
# input into search field of Find more Solution
Input_FMS = driver.find_element(By.ID, "helpsearch")
Input_FMS.send_keys("Cancel Order")
# Click go
Input_FMS.send_keys(Keys.ENTER)
# verify "Cancel Items or Orders"
Result_amazon = driver.find_element(By.XPATH, "//h1[contains(text(),'Cancel Items or Orders')]").text
if "Cancel Items or Orders" == Result_amazon:
print("Test case passed")
else:
print("Test case failed")
driver.find_element(By.CSS_SELECTOR,)