【发布时间】:2020-05-03 05:43:23
【问题描述】:
我还有一个关于ElementNotInteractableException: Message: element not interactable的问题
我正在迈出 Python 的第一步(尝试启动 QA 自动化路线(多年来一直是手动 QA))。因此,我尝试在网上查找此内容,但没有找到适合我的答案。
描述(如果你想跳过):我正在尝试运行一个简单的代码来询问 MTG 卡,然后去寻找它的价格(在这个脚本的后续迭代中,你将能够从要查询的页面列表中进行选择)
代码:
from selenium import webdriver
from time import sleep
from xpaths import *
card = input('What card are you looking for?')
driver = webdriver.Chrome()
driver.get(url)
searchBox = driver.find_element_by_xpath(searchBox)
sleep(1)
searchBox.send_keys(card)
无论我尝试什么(睡觉、等待、点击元素),我总是得到相同的响应
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(顺便说一句,我正在尝试在 starcitygames.com 中搜索卡片)
任何帮助将不胜感激,请记住这是我第一次真正的编码尝试。
编辑:
我通过 xpath = searchBox = '//*[@id=\"search_query\"]' 找到元素 searchBox
谢谢!
【问题讨论】:
-
你能显示
searchBox中的内容吗? -
我的错! searchBox = '//*[@id=\"search_query\"]'
-
您是否尝试过显式等待元素可点击?
-
我现在正在尝试,但没有成功。我正在尝试找到适合我需要的方式来编写它