【发布时间】:2014-03-13 17:10:42
【问题描述】:
我的代码:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
site = "https://blockchain.info/wallet/login"
identifier = "myIdentifier"
browser = webdriver.Firefox()
browser.get(site)
browser.find_element_by_xpath('/html/body/div[5]/div[4]/div/div/div[2]/div/div/input'.send_keys(identifier)
我运行它并收到此错误:
(来源:gyazo.com)
大图:http://gyazo.com/897fe2b83db36585b3521cc1a06aa832
我在该行之后尝试了诸如评论之类的操作,上下移动它,但我不知道这里有什么问题
【问题讨论】:
-
不知道是不是这样,但括号在你的最后一行不匹配。您可能想在
send_keys之前添加一个结束语? -
这是您的代码的图像,您看到了什么错误?
-
不错的收获。谢谢你。解决了
-
@usmcs,唯一的错误是“无效语法”,但正如不知道所说,我遗漏了一个括号
-
这么长的行完美地演示了为什么像 pep8 这样的编码标准是好的。如果断线和正确缩进的行会更快地看到他的问题。
标签: python selenium selenium-webdriver