这是我遇到的异常:
Traceback (most recent call last):
File "/home/navendu/lead-generator/python_scripts/tempCodeRunnerFile.py", line 12, in <module>
driver.switch_to_frame("http://103.251.43.139/~ksebuser/orumabills/upload/billview/")
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 789, in switch_to_frame
self._switch_to.frame(frame_reference)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/switch_to.py", line 87, in frame
raise NoSuchFrameException(frame_reference)
selenium.common.exceptions.NoSuchFrameException: Message: http://103.251.43.139/~ksebuser/orumabills/upload/billview/
这是我正在运行的 python 代码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("http://www.kseb.in/index.php?option=com_wrapper&view=wrapper&Itemid=813&lang=en")
driver.maximize_window()
driver.implicitly_wait(7)
driver.switch_to_frame("http://103.251.43.139/~ksebuser/orumabills/upload/billview/")
ele = driver.find_element_by_id('t_consumer-no_5')
ele.send_keys("some text")
这是网页的链接。我正在尝试在该网站上自动填写表格 http://www.kseb.in/index.php?option=com_wrapper&view=wrapper&Itemid=813&lang=en
此错误消息...
selenium.common.exceptions.NoSuchFrameException: Message: http://103.251.43.139/~ksebuser/orumabills/upload/billview/
...暗示 ChromeDriver 无法找到所需的 <iframe>
元素。
<小时/>
看来你们已经很接近了。 <iframe>
将 src 属性设置为 http://103.251.43.139/~ksebuser/orumabills/upload/billview/
。因此,提及 src 属性就可以解决您的问题。
但是,由于所需的元素位于 <iframe>
内因此,要在元素内发送字符序列,您必须:
<小时/>
引用
您可以在以下位置找到一些相关讨论:
我是一名优秀的程序员,十分优秀!