[英]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.