简体   繁体   English

我无法使用 Selenium 单击其 ID 的元素。当我检查元素时,圆角矩形内写有“flex”。 任何解决方案?

[英]I'm unable to click on a element with it's ID using Selenium. There's "flex" written inside a rounded rectangle when I inspect element. Any solutions?

I'm trying to click on an element using selenium and make a calender pop up.我正在尝试使用 selenium 单击一个元素并弹出一个日历。 I think that the "flex thingy" has something to do with this.我认为“flex thingy”与此有关。

I'm trying to click on the "Date of Travel" button to make the calender pop up on this website: https://www.path2usa.com/travel-companion/我试图点击“旅行日期”按钮,使日历在这个网站上弹出: https://www.path2usa.com/travel-companion/

Here's my code这是我的代码

driver.get("https://www.path2usa.com/travel-companion/");
driver.findElement(By.id("form-field-travel_comp_date")).click();

For some reason, the calendar does not pop up.由于某种原因,日历没有弹出。

I'm very new to this and I apologize if this sounds stupid.我对此很陌生,如果这听起来很愚蠢,我深表歉意。 I'd really appreciate any help!我真的很感激任何帮助!

Actually this has nothing to do with flex.实际上这与flex无关。 I had to scroll a bit lower for the calender to pop up.我必须向下滚动一点才能弹出日历。 The below code sorted things.下面的代码对事物进行了排序。

driver.get("https://www.path2usa.com/travel-companion/");   
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("window.scrollBy(0,800)");
Thread.sleep(3000);
driver.findElement(By.id("form-field-travel_comp_date")).click();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ChromeDriver不会单击元素。 硒。 爪哇 - ChromeDriver doesn't click on element. Selenium. Java 在使用 Selenium 进行测试自动化期间检查元素时,某些网页中的元素“id”会发生变化(非静态)。 如何处理这种情况? - Element "id" changes(not static) in some web pages when inspecting elements during test automation using Selenium. How to handle this situation? 无法使用硒单击元素 - Unable to click on an element using Selenium 如何通过在Selenium WebDriver中查找ID来单击确切的元素? - How to click the exact element by finding the ID's in Selenium WebDriver? 我的appium创建了元素但是不能点击元素。 它说“无法点击。找到该元素但在屏幕上不可见” - My appium is founded the element but Cannot click element. it's say "Cannot click. The element is found but not visible on Screen" 无法检查HTML页面上的元素(右键单击检查元素) - Unable to inspect element on HTML page (right click inspect element) 我在 if() 语句中遇到错误:org.openqa.selenium.NoSuchElementException: Unable to locate element: .//*[@id='p40021404_qty'] - I'm getting error in if() statement: org.openqa.selenium.NoSuchElementException: Unable to locate element: .//*[@id='p40021404_qty'] Selenium:无法通过它包含来定位元素 - Selenium: Unable to locate element by it's contain 无法在 Java 中使用 Selenium 单击 Web 元素 - Unable to click on Web Element using Selenium with Java 无法在 Safari 13.0.4 中使用 Selenium 单击元素 - Unable to click on element using Selenium in Safari 13.0.4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM