Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have the following element:

<input type="hidden" data-dojo-attach-point="vn" value="adrija" aria- 
hidden="true">

The above element is an element of dropdown and is hidden. The code that I have written is:

private WebElement adrija = Driver.driver.findElement(By.xpath("//input[@value='adrija' and @data-dojo-attach-point='vn']"));
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].click();", adrija);

It says it's not able to find the element.

Please help. Thanks. :)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
164 views
Welcome To Ask or Share your Answers For Others

1 Answer

Use css selector

driver.findElement(By.cssSelector("input[type='hidden']"))

Or xpath

driver.findElement(By.xpath("//input[@type='hidden']"))

Note : the field has type hidden. You cannot do visible interaction like sendkeys or click as it is invisible


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...