ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

UI自动化测试-05-Selenium元素定位--CSS定位元素

2022-01-22 18:32:52  阅读:31  来源: 互联网

标签:定位 05 元素 driver DaiMa sleep input import 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

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有