Selector only working after inspecting selecting element selenium

0 votes

I work on selenium with java and when I try find element by (ID, xPath, css) all return the same exception:

'Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable 
 to locate element: {"method":"css selector","selector":"#City"} '

the element inside form without frame,

when I open Dev Tools in Chrome the execution context is set to top. AND my controls are located within form, that is a different context, not accessible from top. when I change context from top to the second option the controls appear

my question: how can I change the execution context from top to second option by selenium with java so I can locate controls ??

Jun 11, 2020 in Selenium by Arwa
• 120 points
782 views
Hey @Arwa, could you please post the code snippet you are using?

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Selenium

0 votes
2 answers

Unable to Click on an Element in Selenium (Python) even after finding it.

Here, I give you working script which ...READ MORE

answered Sep 19, 2018 in Selenium by Priyaj
• 58,120 points
18,789 views
0 votes
1 answer

Locating an element by value using css selector using Selenium WebDriver

Below code will help By.cssSelector("td[class='someclass'][value=' ...READ MORE

answered Apr 9, 2018 in Selenium by coldcode
• 2,070 points
641 views
0 votes
1 answer

Error: FF Browser not working for Selenium test after update

Since Firefox's latest update to version 47.0, ...READ MORE

answered Apr 20, 2018 in Selenium by king_kenny
• 3,710 points
422 views
+1 vote
2 answers
0 votes
0 answers

How to hover element when action class is not working in my Selenium framework ?

When i am writing the code to ...READ MORE

Feb 15, 2019 in Selenium by Raishul
2,126 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,520 points
5,080 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,010 points
5,816 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
3,581 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2, 2020 in Selenium by Sri
• 3,010 points
4,323 views