本文主要是介绍Selenium的判断,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
from selenium import webdriver
from time import sleep
driver = webdriver.Firefox()
URL = r"C:\Users\I\Desktop\注册A.html"
driver.get(URL)
driver.find_element_by_css_selector("#userA").send_keys("admin")
# size = driver.find_element_by_css_selector("#userA").size
# print(size)
# tag_name = driver.find_element_by_css_selector("#userA").tag_name
# print(tag_name)
# 获取a上面href的超链接地址
# ari = driver.find_element_by_css_selector("a").get_attribute("href")
# print(ari)
# 判断span标签是否可用
# play = driver.find_element_by_css_selector("span").is_displayed()
# print(play)
# 判断取消按钮是否可用
# ena = driver.find_element_by_css_selector("#cancelA").is_enabled()
# print(ena)
# 判断旅游按钮是否已被选中
# sle = driver.find_element_by_css_selector("#lyA").is_selected()
# print(sle)
sleep(3)
driver.quit()
这篇关于Selenium的判断的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!