|
#coding=utf-8
from selenium import webdriver
import time
driver = webdriver.Firefox()
# driver.set_window_size(480,800) 设置浏览器大小
driver.get("http://10.188.181.74:9082/sso-webapp")
driver.maximize_window()
#登录系统
driver.find_element_by_name('username').clear()
driver.find_element_by_name('username').send_keys('zhulj')
driver.find_element_by_name('psword').clear()
driver.find_element_by_name('psword').send_keys('1')
driver.find_element_by_name('submitBtn').click()
time.sleep(30)
#进入需求填报销单
driver.find_element_by_xpath("/html/body/div/div/div[2]/div[3]/div/a[2]/div/div/p[2]").click()
time.sleep(20)
driver.find_element_by_xpath("/html/body/div[1]/div[1]/div[3]/div/div[2]/ul/li[6]/a").click() #就这句了
报错信息:
C:\Users\sunl\AppData\Local\Programs\Python\Python36\python.exe E:/自动化测试/test/登录客反.py
Traceback (most recent call last):
File "E:/自动化测试/test/登录客反.py", line 26, in <module>
driver.find_element_by_xpath("/html/body/div[1]/div[1]/div[3]/div/div[2]/ul/li[6]/a").click()
File "C:\Users\sunl\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 306, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "C:\Users\sunl\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 784, in find_element
'value': value})['value']
File "C:\Users\sunl\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 249, in execute
self.error_handler.check_response(response)
File "C:\Users\sunl\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: /html/body/div[1]/div[1]/div[3]/div/div[2]/ul/li[6]/a |
|