在python硒中,如何找到元素的可见性? [英] In python selenium, how does one find the visibility of an element?
本文介绍了在python硒中,如何找到元素的可见性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我找到了还有,什么是定位器"?
Also, what is a "locator"?
任何帮助将不胜感激.
推荐答案
您应改用is_displayed()
:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('http://www.google.com')
element = driver.find_element_by_id('gbqfba') #this element is visible
if element.is_displayed():
print "Element found"
else:
print "Element not found"
hidden_element = driver.find_element_by_name('oq') #this one is not
if hidden_element.is_displayed():
print "Element found"
else:
print "Element not found"
这篇关于在python硒中,如何找到元素的可见性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文