我試過is_Enable() 但是都得到是true,所以現在用get_attribute來確認
I have tried is_Enable method but I always get true.
I decide to use "get_attribute" but its return is true/None. not false. Be carefull
[updated] I found answer. I should use is_selected() rather than is_enabled()
is_enabled
()
Returns whether the element is enabled.
is_selected
()
Returns whether the element is selected.
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Firefox()
driver.get("your.site.with.dragndrop.functionality.com")
s
element = driver.find_element_by_id("widgetID")
print(element.get_attribute("checked")) //true
element.click()
print(element.get_attribute("checked")) //None
element.click()
print(element.get_attribute("checked")) //true
No comments:
Post a Comment