本文整理汇总了Python中selenium.webdriver.support.ui.WebDriverWait.value_of_css_property方法的典型用法代码示例。如果您正苦于以下问题:Python WebDriverWait.value_of_css_property方法的具体用法?Python WebDriverWait.value_of_css_property怎么用?Python WebDriverWait.value_of_css_property使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.support.ui.WebDriverWait
的用法示例。
在下文中一共展示了WebDriverWait.value_of_css_property方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hotkey
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import value_of_css_property [as 别名]
def test_hotkey(self):
driver = self.driver
shift_n_label = WebDriverWait(self.driver, 10).until(
expected_conditions.visibility_of_element_located((By.ID, "_Shift_n"))
)
ActionChains(driver).key_down(Keys.SHIFT).send_keys("n").key_up(Keys.SHIFT).perform()
self.assertEqual("rgba(12, 162, 255, 1)", shift_n_label.value_of_css_property("background-color"))
示例2: _verifyRGB
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import value_of_css_property [as 别名]
def _verifyRGB(self, driver, imageName, rgbStr ):
xPath = "//div[@qxclass='skel.widgets.Image.Stack.TreeItem']/div[text()='" + imageName + "']/../div[@qxclass='skel.widgets.Image.Stack.CustomIcon']"
item = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, xPath)))
styleStr = item.get_attribute("style")
print "Style=",styleStr
rgb = item.value_of_css_property( 'background-color')
print "RGB color=",rgb
print "RGBSTR=", rgbStr
self.assertTrue( rgb==rgbStr, "Red Icon not correct color")
示例3: test_
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import value_of_css_property [as 别名]
def test_():
rollbar.init(os.environ.get('rollbar'))
email = os.environ.get('email')
password = os.environ.get('password')
assert email and password
wait_time = int(os.environ.get('wait', default_wait))
try:
options = webdriver.ChromeOptions()
options.add_argument('--headless')
driver = webdriver.Chrome(chrome_options=options)
driver.get(renren)
input_email = WebDriverWait(driver, wait_time).until(
EC.presence_of_element_located((By.ID, 'email'))
)
input_password = WebDriverWait(driver, wait_time).until(
EC.presence_of_element_located((By.ID, 'password'))
)
btn_login = WebDriverWait(driver, wait_time).until(
EC.presence_of_element_located((By.ID, 'login'))
)
input_email.clear()
input_password.clear()
input_email.send_keys(email)
input_password.send_keys(password)
driver.execute_script('arguments[0].click()', btn_login)
btn_fortune = WebDriverWait(driver, wait_time).until(
EC.presence_of_element_located((By.ID, 'assembleBtn'))
)
driver.execute_script('arguments[0].click()', btn_fortune)
popup = WebDriverWait(driver, wait_time).until(
EC.visibility_of_element_located((By.ID, 'forPopupBox'))
)
passed = popup.value_of_css_property('display') == 'block'
if not passed:
rollbar.report_message('Test Failed')
assert passed
except WebDriverException:
rollbar.report_message('Test Errored')
assert False
else:
rollbar.report_message('Test Passed')
assert True
finally:
driver.quit()
示例4: test_hotkey
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import value_of_css_property [as 别名]
def test_hotkey(self):
driver = self.driver
shift_n_label = WebDriverWait(self.driver, 10).\
until(expected_conditions.visibility_of_element_located((By.ID, '_Shift_n')))
ActionChains(driver).\
key_down(Keys.SHIFT).\
send_keys('n').\
key_up(Keys.SHIFT).perform()
self.assertEqual('rgba(255, 255, 255, 1)',
shift_n_label.value_of_css_property('background-color'))
示例5: test_hotkey
# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import value_of_css_property [as 别名]
def test_hotkey(self):
driver = self.driver
shift_n_label = WebDriverWait(self.driver, 10).until(
expected_conditions.visibility_of_element_located(
(By.ID, "_Shift_n")
)
)
# needs driver instance then can arrage sequence of events by
# calling the availaable methods and executing the action with
# the perform method
ActionChains(driver).key_down(
Keys.SHIFT
).send_keys(
'n'
).key_up(
Keys.SHIFT
).perform()
self.assertEqual(
"rgba(255, 255, 255, 1)",
#"rgba(12, 162, 255, 1)",
shift_n_label.value_of_css_property("background-color")
)