Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';t将文本添加到输入类型=";电话:;在IFrame内部使用seleniumpython_Python_Selenium_Selenium Webdriver_Input_Web Scraping - Fatal编程技术网

Can';t将文本添加到输入类型=";电话:;在IFrame内部使用seleniumpython

Can';t将文本添加到输入类型=";电话:;在IFrame内部使用seleniumpython,python,selenium,selenium-webdriver,input,web-scraping,Python,Selenium,Selenium Webdriver,Input,Web Scraping,我试着写下: CVXPATH='//input[@type=“tel”] cv=驱动程序。通过xpath(CVXPATH)查找元素 简历发送钥匙(“000”) 但我有一个错误: line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotInteractableException: Message: element not

我试着写下:

CVXPATH='//input[@type=“tel”]
cv=驱动程序。通过xpath(CVXPATH)查找元素
简历发送钥匙(“000”)

但我有一个错误:

line 242, in check_response 
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
我怎样才能解决这个问题

我尝试了此方法,该方法适用于同一网页上的其他按钮(不同类),但不适用于此特定按钮,我还尝试了使用div类:

xpathoo = '//button[@class="ncss-brand pt2-sm pr5-sm pb2-sm pl5-sm ncss-btn-accent continueOrderReviewBtn mod-button-width ncss-brand\
            pt3-sm prl5-sm pb3-sm pt2-lg pb2-lg d-sm-b d-md-ib u-uppercase u-rounded fs14-sm"]'
driver.find_element_by_xpath(xpathoo).click()

元素存在于
iframe
中,您需要首先切换到
iframe
,以便在输入字段中发送值

导入
WebDriverWait
(),等待
frame\u可用,然后切换到
()并跟随
CSS选择器。

诱导
WebDriverWait
()并等待
元素可点击
()并跟随
XPATH

WebDriverWait(driver,10).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,'iframe.credit-card-iframe-cvv')))
cv=WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//input[@id="cvNumber" and @type="tel"]')))
cv.send_keys("000")
您需要导入以下库

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

在发送“000”之前,您是否尝试过单击该框?是的,没有任何更改我有此
第80行,在until raise TimeoutException(消息、屏幕、堆栈跟踪)selenium.common.exceptions.TimeoutException:message:
@dip检查元素是否在任何帧内?xpath应该一直适用于您,直到有任何iframe存在为止?或者您可以发布元素的页面源。有时根据屏幕截图很难给出正确的分辨率。@dip:您可以尝试Xpath2选项吗?@dip元素在iframe中,您需要先切换它。请尝试更新的答案。让我知道它是如何运行的。