How to start ChromeDriver with existing login

14,048 views
Skip to first unread message

Tiếu Thủy

unread,
Nov 26, 2014, 9:59:10 AM11/26/14
to seleniu...@googlegroups.com
Dear all,

I want to test a website with ChromeDriver, but everytime I started the ChromeDriver, it is a new instance, so I have to login from the beginning to access the website.

However, in my Google Chrome (I also use Chrome as default browser), I selected "Remember Login" so I can access the content of the website directly without logging on again.

Can I do like this with ChromeDriver?

Thank you very much.
(I am using Selenium 2.44.0 Java)

arunchandu ganta

unread,
Nov 27, 2014, 2:49:04 AM11/27/14
to seleniu...@googlegroups.com
Hi,

As on my exp on selenium... we can't do it, Any webdriver wont store the cookies or cache so even if you click on 'Remember Login also its wont work for next time. Its just two lines of code for login you can add that in starting... is there any problem on that?

Thanks
Arunchandu

Vinh Đặng

unread,
Nov 27, 2014, 3:41:43 AM11/27/14
to seleniu...@googlegroups.com
Hello Arunchandu

How can I do it with two lines of code? Could you give me some more hints?

Actually, I want to login to Zoho Writer. (https://www.zoho.com/docs)




----------------------------------
Best Regards
 
Vinh Dang


--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/CL8kdxhgdj0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5e6d37c8-3b36-4932-a3e6-7e3d207e91a0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

arunchandu ganta

unread,
Nov 27, 2014, 5:13:01 AM11/27/14
to seleniu...@googlegroups.com
Hi Dang,

I giving the webdriver Code using Java. 

Code:
driver.findElement(By.id("lid")).sendKeys("UserName");
driver.findElement(By.id("pwd")).sendKeys("password");
driver.findElement(By.name("submit")).click();

When every you required the login in that site use that and provide the proper username and password.


Have a Great Day!!!

Thanks
Arunchandu 

Manoj Hans

unread,
Nov 27, 2014, 5:25:52 AM11/27/14
to seleniu...@googlegroups.com
Try below code--

        System.setProperty("webdriver.chrome.driver","path of chromedriver.exe");
        ChromeOptions options = new ChromeOptions();
        options.addArguments("user-data-dir=C:/Users/mention user name/AppData/Local/Google/Chrome/User Data/Default");
        options.addArguments("--start-maximized");
        WebDriver driver = new ChromeDriver(options);
        driver.get("https://mail.google.com");

Once browser open with gmail SignIn page then follow the following steps--
1. Type your username and password manually
2. Close the browser
3. run again the same code

Now you dont need to provide username and password again...:)
Note- Above code will work with window 7,8.


--Manoj Hans

Srikanth Reddy Akkala

unread,
Oct 30, 2018, 10:40:32 AM10/30/18
to Selenium Users
This is working fine,thanks..!

parveen banu

unread,
Feb 14, 2019, 6:45:17 AM2/14/19
to Selenium Users
Really helped.. :)
Reply all
Reply to author
Forward
0 new messages