本文整理汇总了Python中marionette_driver.marionette.Marionette.find_element方法的典型用法代码示例。如果您正苦于以下问题:Python Marionette.find_element方法的具体用法?Python Marionette.find_element怎么用?Python Marionette.find_element使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marionette_driver.marionette.Marionette
的用法示例。
在下文中一共展示了Marionette.find_element方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Marionette
# 需要导入模块: from marionette_driver.marionette import Marionette [as 别名]
# 或者: from marionette_driver.marionette.Marionette import find_element [as 别名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from marionette_driver.marionette import Marionette
import pdb
client = Marionette("localhost", port=2828)
client.start_session()
client.navigate("http://www.tianyancha.com/company/75507246")
element = client.find_element("class name", 'company_info')
print element.text
示例2: Marionette
# 需要导入模块: from marionette_driver.marionette import Marionette [as 别名]
# 或者: from marionette_driver.marionette.Marionette import find_element [as 别名]
parser = argparse.ArgumentParser(description='Bulk Reject translations on GlotPress with Firefox')
parser.add_argument('--search', dest='search', help='The term with problems', required=True, type=str)
parser.add_argument('--remove', dest='remove', help='The wrong translation to remove', required=True, type=str)
parser.add_argument('--replace', dest='replace', help='The new translation to submit', required=False, type=str)
parser.add_argument('--lang', dest='lang', help='The locale, eg: it', default="it")
args = parser.parse_args()
# Load configuration
config = ConfigParser.RawConfigParser()
config.readfp(open('config.ini'))
print "Connection in progress to Firefox"
client = Marionette(host='127.0.0.1', port=28288)
client.start_session()
print "Connection to Firefox Done"
# Detect if already logged
try:
client.find_element(By.CSS_SELECTOR, 'body.logged-in')
client.navigate("https://translate.wordpress.org/wp-login.php?action=logout&redirect_to=https%3A%2F%2Ftranslate.wordpress.org%2F&_wpnonce=583839252e")
except:
pass
# Login
client.navigate("https://login.wordpress.org/?redirect_to=https%3A%2F%2Ftranslate.wordpress.org%2F")
try:
#Log In Form
usernameLogin = client.find_element(By.ID, 'user_login')
usernameLogin.click()
usernameLogin.send_keys(config.get('Login', 'user'))
passwordLogin = client.find_element(By.ID, 'user_pass')
passwordLogin.click()
passwordLogin.send_keys(config.get('Login', 'pass'))
# Click on the Log in button to connect
client.find_element(By.ID, 'wp-submit').click()