0

I'm coding a selenium driver program have auto login but I cant find anything on login form.

How to input text in password and account on this form?

Blank form need to input text

Quockhanh Pham
  • 384
  • 2
  • 11

3 Answers3

0

It's not HTML form. It's a dialog supplied by OS, not browser. So you can't use selenium to automate it.

You can use Java Class Robot to operate it, but Robot class can only operate dialog on local where your script reside. If you use RemoteWebDriver and open browser on remote machine, the Robot class will can't work.

So far as I know, there is no good solution to support local and remote cases same time.

yong
  • 13,357
  • 1
  • 16
  • 27
  • I will be trying view Robot package. Do you give me any technical or library or even any language that can auto-login this form? – Quockhanh Pham May 22 '18 at 04:44
  • Hope this post can help you as beginning: https://www.guru99.com/using-robot-api-selenium.html – yong May 22 '18 at 05:40
  • I tried use Robot but It does not work. Selenium wait to load page for unlimited so it cant run next code. I tried create new Thread for input Robot, auto press function run but nothing input on form – Quockhanh Pham May 22 '18 at 11:25
0

You are talking about basic-auth and there are some solutions.

Selenium - Basic Authentication via url

Either via credentials in url(which doesnt work for chrome anymore) or remote-debugging in chrome.

Chrome remote debugging in a seleniumgrid

Henning Luther
  • 2,067
  • 15
  • 22
  • Can you help me run auto program on localhost (single machine) first? – Quockhanh Pham May 22 '18 at 11:29
  • the easiest thing you can do is using chrome version <59, e.g. 58 and url credentials "http://user:pass@url". if not you need to connect via webservice to the chrome debugger: https://medium.com/@sahajamit/selenium-chrome-dev-tools-makes-a-perfect-browser-automation-recipe-c35c7f6a2360 – Henning Luther May 22 '18 at 12:18
0

Try this

import org.openqa.selenium.NoAlertPresentException; 
import org.openqa.selenium.Alert;
driver.switchTo().alert().sendKeys("username" + Keys.TAB + "password"); 
driver.switchTo().alert().accept();

If ur using selenium with java try this

import org.openqa.selenium.NoAlertPresentException; 
import org.openqa.selenium.Alert;
driver.switchTo().alert().sendKeys("username" + Keys.TAB + "password"); 
driver.switchTo().alert().accept();
bhupathi turaga
  • 297
  • 2
  • 16