只记录个人使用以及项目内开发使用的常见方法
一、基础网页元素定位
1.class定位法
调用语法:
点击事件:
driver.find_element_by_class_name("ed-right-bar_avatar_wrap").click()
输入事件:
driver.find_element_by_class_name("class的内容").send_keys("输入内容")
2.Xpath定位法
Xpath取值:定位元素后右键复制xpath的值
调用语法:
点击事件:
driver.find_element_by_xpath('//*[@id="pane-account"]').click()
输入事件:
driver.find_element_by_xpath('//*[@id="pane-account"]').send_keys()
基础定位定位百度的实例:
from selenium import webdriver
from time import sleep
class TestCase(object):
def __init__(self):
self.driv