背景:要单击的按钮:button
上下文中的项:context_item
actions = ActionChains(driver)
actions.context_click(button).move_to_element(context_item).click().perform()
报告了一个TypeError:rect is undefined
actions.....perform()
行之后添加wait.until函数wait = WebDriverWait(driver,10)
context_item = wait.until(expected_conditions.element_to_be_clickable((By.CSS_SELECTOR,"css_selector_for_context_item"))
在代码SyntaxError: unexpected EOF while parsing
的最后一行报告了一个错误
context_item
由wait.until
行定义,因此我调整了顺序button = xxxxxx
context_item = wait.until(expected_conditions.element_to_be_clickable((By.CSS_SELECTOR,"css_selector_for_context_item"))
actions.context_click(button).move_to_element(context_item).click().perform()
在actions......perform()
行上报告了SyntaxError
SyntaxError: invalid syntax