selenium基础--五种定位方式

find_element_by_name
find_element_by_id
find_element_by_xpath
find_element_by_link_text
find_element_by_partial_link_text
find_element_by_tag_name
find_element_by_class_name
find_element_by_css_selector
from time import sleep
from selenium import webdriver

br = webdriver.Chrome()

url = "https://www.tmall.com"
br.get(url)

content = br.find_element_by_xpath('//*[@id="mallSearch"]/form/fieldset/div/button')
print(content)


br.close()
原文地址:https://www.cnblogs.com/php-linux/p/12463359.html