UI自动化测试-05-Selenium元素定位--CSS定位元素
作者:互联网
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
</head>
<body>
please input your name:<input name="name" class="classname" >
<br>
<a href="http://map.baidu.com">I'm Storm</a>
</body>
</html>
from selenium import webdriver
from time import sleep
"""
通过css定位页面元素
"""
driver = webdriver.Chrome()
driver.get('E:\XueXi\ZDH\DaiMa\DaiMa\CZBK\one\myhtml5.html')
driver.find_element_by_css_selector("body > input").send_keys('css')
sleep(3)
driver.quit()
标签:定位,05,元素,driver,DaiMa,sleep,input,import,css 来源: https://www.cnblogs.com/jenny-jenny/p/15834707.html