所以我试着打开一个网站,然后导航到一个特定的页面,其中包含我必须从中删除数据的页面。我可以给出输入,但在到达最终提交按钮之前,我得到了错误“selenium.common.异常.ElementNotInteractiableException:消息:无法将元素滚动到视图中。有什么想法吗?在
我已经尝试过引入wait方法,但它仍然没有给出有用的结果,而是减慢了站点的速度。下面是代码。在
from selenium import webdriver
driver=webdriver.Firefox()
ok=driver.find_element_by_css_selector('#dropdownlistContentdrpState > input').send_keys('Chandigarh')
#time.sleep(5)
ok2=driver.find_element_by_css_selector('#dropdownlistContentdrpSchoolManagement > input').send_keys('Pvt. Unaided')
#driver.refresh()
time.sleep(10)
ok3=driver.find_element_by_css_selector('#btnSearch')
ok3.click()
time.sleep(4)
错误
"selenium.common.exceptions.ElementNotInteractableException: Message: Element could not be scrolled into view"
表示程序试图与之交互的元素无法滚动到视图中。在为了克服这个问题,您可以引入
WebDriverWait
并单击或首先使用element.location_once_scrolled_into_view
,然后单击元素。在或者可以使用
Javascript's executor
单击元素。在或者
^{pr2}$或者
相关问题 更多 >
编程相关推荐