javaseleniuminternet-explorerselenium-iedriveriedriverserver

Why is selenium web driver doesn't find the textfield on this website?


What should happen is that these textfields for login should be filled and the the login button should be pressed (some sort of auto login)

Here is the link to the webpage: Telekom Email Login Page

This are the three methods I'm using:

public String exportDriver() throws IOException {
        final InputStream IEDriverStream = getClass().getResourceAsStream("/Driver/IEDriverServer.exe");
        final File ieDriverServer = FileWebOpener.stream2file(IEDriverStream, "IEDriverServer", ".exe");
        System.setProperty("webdriver.ie.driver", ieDriverServer.getAbsolutePath());
        return ieDriverServer.getAbsolutePath();
    }

    public void goToWebsite(String url) {
        driver = new InternetExplorerDriver();
        driver.get(url);
    }

    public void setUsernameAndPassword(String username, String password, int Website) throws InterruptedException {
       try{ new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("input#user[name='pw_usr']"))).sendKeys(username);
        driver.findElement(By.cssSelector("input#pw_pwd[name='pw_pwd']")).sendKeys(password);
        driver.findElement(By.cssSelector("input.button.standard_button_size.large#pw_submit")).click();
    } catch(Exception e){
           e.printStackTrace();
       }
    }

This is the exception I get


Solution

  • I have tested it with C# and get the right behaviors. Below is the code:

    using OpenQA.Selenium;
    using OpenQA.Selenium.IE;
    using OpenQA.Selenium.Support.UI;
    using System;
    
    namespace IEWebDriver
    {
        class Program
        {
            static void Main(string[] args)
            {
                string username = args.Length > 1 ? args[1] : "test";
                string password = args.Length > 1 ? args[2] : "test";
                IWebDriver driver = new InternetExplorerDriver();
                //IWebDriver driver = new ChromeDriver();
    
                //Navigate to test URL
                driver.Navigate().GoToUrl("https://accounts.login.idm.telekom.com/idmip?openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.return_to=https%3A%2F%2Ftipi.api.t-online.de%2Fsrp-auth%2FoneIdm%2Fverify%3FreturnToUrl%3Dhttps%3A%2F%2Femail.t-online.de%2Fem&openid.realm=https%3A%2F%2Ftipi.api.t-online.de&openid.assoc_handle=S4d53c348-b3f2-49a9-b13e-65ade0af6da4&openid.mode=checkid_setup&openid.ns.ext1=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0&openid.ext1.mode=fetch_request&openid.ext1.type.attr1=urn%3Atelekom.com%3Aall&openid.ext1.required=attr1&openid.ns.ext2=http%3A%2F%2Fidm.telekom.com%2Fopenid%2Foauth2%2F1.0&openid.ext2.client_id=10LIVESAM30000004901PORTAL00000000000000&openid.ext2.scopes=W3sic2NvcGUiOiJzcGljYSJ9XQ%3D%3D&openid.ns.ext3=http%3A%2F%2Fidm.telekom.com%2Fopenid%2Fext%2F2.0&openid.ext3.logout_endpoint=https%3A%2F%2Ftipi.api.t-online.de%2Fsrp-auth%2FoneIdm%2Flogout&openid.ns.ext4=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fui%2F1.0&openid.ext4.mode=popup");
    
                try
                {
                    new WebDriverWait(driver, new TimeSpan(0, 0, 20, 60)).Until(c => c.FindElement(By.CssSelector("input#user[name='pw_usr']"))).SendKeys(username);
                    driver.FindElement(By.CssSelector("input#pw_pwd[name='pw_pwd']")).SendKeys(password);
                    driver.FindElement(By.CssSelector("input.button.standard_button_size.large#pw_submit")).Click();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                Console.ReadKey();
                //Close the browser
                driver.Quit();
                //driver.Close();
    
            }
        }
    }