當前位置: 首頁>>代碼示例>>Python>>正文


Python Marionette.find_element方法代碼示例

本文整理匯總了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

開發者ID:lg31415,項目名稱:antitools,代碼行數:16,代碼來源:testtianya.py

示例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()
開發者ID:Mte90,項目名稱:BulkRejectGP,代碼行數:33,代碼來源:bulkrejectgp.py


注:本文中的marionette_driver.marionette.Marionette.find_element方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。