我试图自动化Yatra网站,但选择日历中的值时卡住了。我无法向下滚动日历。无法向下滚动日历,同时自动化Yatra.com(使用python的Selenium webdriver)
-2
A
回答
0
您可以在Python中使用这样的:
element = driver.find_element_by_xpath("your xpath")
driver.execute_script("arguments[0].scrollIntoView();", element)
0
如果你试图查找向下滚动一些元素,下面的代码将滚动,直至该元素是在视图中。
WebElement element = driver.findElement(By.xpath("//div[@id='PegasusCal-0']//div[@class='cal-body']"));
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element);
Thread.sleep(500);
//do anything you want with the element
+2
当要求其他人@ SaniketA.Soni的代码时,要更尊重 – Worm
相关问题
- 1. 滚动到Selenium Webdriver(Python)
- 2. 垂直向下滚动并使用java在Selenium WebDriver中向上滚动
- 3. Selenium Webdriver无头/无GUI自动化
- 4. Selenium PhantomJS向下滚动
- 5. 使用Selenium无法自动化页面
- 6. 如何在selenium webdriver的下拉窗口中向下滚动?
- 7. Python Selenium自动化
- 8. 使用Selenium WebDriver与Java滚动
- 9. 使用Selenium Web Driver(Appium)向下滚动使用Java
- 10. 自动向下滚动使用php
- 11. 使用selenium webdriver与Python自动化网站的参数化功能
- 12. Selenium Webdriver自动完成下拉
- 13. 自动向下滚动iframe
- 14. 自动向下滚动EditText
- 15. Textarea自动向下滚动
- 16. 使用Selenium webdriver测试自动填充
- 17. 使用滚动条自动向下滚动网站部分
- 18. BrowserMob无法使用Selenium Webdriver
- 19. 浮动p:滚动时的日历
- 20. 使用Selenium Webdriver和Java的聚合物滑块自动化
- 21. 使用Selenium自动化Gmail
- 22. 如何使用selenium webdriver自动化Silverlight应用程序?
- 23. 禁用向下滚动,同时检测滚动
- 24. 使用Skrollr滚动时正确向下移动div的方法?
- 25. Python - Selenium:向下滚动不起作用,因为PopUp
- 26. 用Jquery自动向下滚动?
- 27. 如何使用selenium webdriver自动化高图表和图表?
- 28. 如何使用Selenium Webdriver自动化验证码?
- 29. 我可以使用Selenium Webdriver自动化Microsoft Dynamics AX吗?
- 30. 让Selenium WebDriver在谷歌地图方向面板中向下滚动
请通过https://stackoverflow.com/help/how-to-ask,写所需的信息,使人们可以帮你 – thebadguy