How to use Selenium to log in to sites requiring a username and password?

I am developing automated test scripts using selenium api with python. But when I run the script from selenium rc, it goes to the login page. How can I provide my username and password on this page since it does not contain sessions or cookies?

+5
source share
2 answers

Here is the suggestion that I made by Adam Gusher on the Selenium IRC channel (irc: //irc.freenode.net/selenium):

Take advantage of the situation with a completely clear browser cache / cookie history. Enter your test to log in.

, , Selenium , Selenium.

+8

, selenium , cookie .

, firefox

,

    SeleniumServer server = new SeleniumServer();
    RemoteControlConfiguration rcc = new RemoteControlConfiguration();
    //rcc.setPort(4444);
    File newFirefoxProfileTemplate = new File(ReadConFile.readcoFile("fiefoxProfilePath"));

    rcc.setFirefoxProfileTemplate(newFirefoxProfileTemplate);
    server = new SeleniumServer(rcc);
    server.start();
    DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*chrome",ReadConFile.readcoFile("serverName"));

firefoxTemplate,

+5

All Articles