0

i tried all the possible ways provided by selenium to find element but i am not successful. below is the code that i am using

System.setProperty("webdriver.chrome.driver","C:\\chromedriver_win32\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://192.168.0.101");
/*below two lines tried but not successful*/ 
WebDriverWait wait = new WebDriverWait (driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#login_username"))).sendKeys("Aa12");
//driver.findElement(By.xpath("//*[@id='login_username']")).sendKeys("Aa12");
//driver.findElement(By.xpath("//input[@id='login_username']")).sendKeys("Aa12");
//driver.findElement(By.name("username")).sendKeys("Aa12"); 
//driver.findElement(By.id("login_username")).sendkeys("Aa12");
//driver.findElement(By.xpath("//input[contains(@value,'Login')]")).click();

my html code for username element is as follows

<input class="input" type="text" name="username" maxlength="16" id="login_username">

i am getting error as

Starting ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}) on port 39970
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#login_username"}

other thing i like to mention that i have enabled protected mode for all internet, local intranet, trusted sites, restricted sites in security settings browser.

After Web scraping of site console showing below error

Failed to load resource: the server responded with a status of 404 (Site or Page Not Found)

i am sure it is not problem of selenium may the web UI need some different way to access page info. please help

user310602
  • 29
  • 1
  • 7
  • I suspect you are getting a security error hitting a https website on somebodies local machine. This would be blocking the page from loading. The error you have shown would not occur if you are running the current code you are showing, if the element wasn't found you would get a TimeoutException. – Ardesco May 23 '19 at 13:25
  • I can login to https://192.168.0.101 without using automation and with selenium IDE it works fine. So how it is blocking the page when i am using selenium webdriver. Is there any solution to prevent blocking. – user310602 May 24 '19 at 02:43
  • I'm guessing based on the information available. The error you have got does not match up with the code you have provided so something is missing in your question. – Ardesco May 24 '19 at 07:27
  • Please look on my question i added some points. i don't know that will help you or not. – user310602 May 24 '19 at 08:50
  • The code you have provided should not throw a `NoSuchElementException` it should throw a `TimeoutException` and you are now stating you are also getting a 404 page not found. I have no idea what the problem is or what you are doing to create this problem. – Ardesco May 24 '19 at 08:55
  • for extracting data of my webpage when I do Ctrl+Shift+I where, in console showing 404 page not found. This is not in eclipse. i am not getting TimeoutException for code which i provided it is always NoSuchElementException in eclipse. May there is some connection between the NoSuchElementException in eclipse and page not found – user310602 May 24 '19 at 09:22

0 Answers0