【发布时间】:2017-06-10 01:10:27
【问题描述】:
我不明白无效字符在哪里,它指向代码的末尾。
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
def page_is_loaded(driver):
return driver.find_element_by_tag_name("body") != None
driver = webdriver.Chrome()
driver.get("https://www.adidas.co.uk/on/demandware.store/Sites-adidas-GB-Site/en_GB/MyAccount-Register")
year = wait.until(EC.visibility_of_element_located((By.XPATH,'//span[@data-val="1990"]')))
driver.execute_script('arguments[0].scrollIntoView(true);', year)
^
SyntaxError: invalid character in identifier
【问题讨论】:
-
欢迎来到 StackOverflow。请阅读并遵循帮助文档中的发布指南。 Minimal, complete, verifiable example 适用于此。在您发布 MCVE 代码并准确描述问题之前,我们无法有效地帮助您。错误消息通常会在语法上最近的行上标记某些内容;我们需要足够的代码来重现问题。
-
很抱歉。
-
括号中的
"1990"]')))末尾似乎有一些奇怪的字符。它在解释器中显示为"]'\U+200C)))。尝试用')))替换它们,复制并粘贴。至少这为我清除了错误。 -
有点工作,但下拉菜单没有向下滚动。
标签: python google-chrome selenium automated-tests