0

I have written the below code to login to the ["http://www.quikr.com/"][1] using selenium IE webdriver (64 bit) and IE 11 browser. But the selenium IE webdriver is unable to click on the 'Sign In' link. Could you please help on the same.

I'm Using:

IE Version: 11

Selenium Version: Version 3.0.1

OS: Win10 64 bit

Java: 1.8

package Selenium_WebDriver_Part1;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class Quikr1 {
    public static WebDriver driver=null;
    @Test
    public void loginTest() throws InterruptedException {
        System.setProperty("webdriver.ie.driver", "C:\\Eclipse\\Drivers\\IEDriverServer.exe");
        DesiredCapabilities ieCaps = DesiredCapabilities.internetExplorer();
        ieCaps.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, "http://www.quikr.com/");
        ieCaps.setCapability(CapabilityType.BROWSER_NAME, "IE");
        ieCaps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
        ieCaps.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
        driver = new InternetExplorerDriver(ieCaps);
        driver.manage().window().maximize();
        Thread.sleep(10000);
        WebDriverWait wait = new WebDriverWait(driver, 10);
                    wait.until(ExpectedConditions.elementToBeClickable(By.xpath(".//*[@class='sign-in']"))).click();
        //driver.findElement(By.xpath(".//*[@id='fullnameFromPopUp']")).sendKeys("UserName");
        //driver.findElement(By.xpath(".//*[@id='password']")).sendKeys("Password");
        //driver.findElement(By.xpath(".//*[@class='btn btn-default btn-default-submit btn-lg btn-block login-btn']")).click();
    }       
}
VISHVAMBRUTH J T
  • 602
  • 4
  • 14
  • 29

1 Answers1

0

You should always post the error message you are getting. You might be getting this

selenium.common.exceptions.NoSuchWindowException: Message: Unable to find element on closed window

This is common problem on the IE. Check out this answer how to solve it. With this change, your code is working for me.

However I am getting really awful performance on your page with IEdriver. Opening the login window pop-up takes 10s. You might want to consider adding some wait function to your code / increase the timeout. Check the docs or this stackoverflow answer.

 driver.findElement(By.cssSelector("span.sign-in")).click();
 // add wait for element / set-up timeout etc
 driver.findElement(By.xpath(".//*[@id='fullnameFromPopUp']")).sendKeys("UserName");
Community
  • 1
  • 1
pagep
  • 3,488
  • 1
  • 26
  • 47
  • I have modified the code to include the wait. But still IE webdriver is unable to click on the Sign In link. I also did the necessary IE settings to make all the zones in the same protected mode and also added: For 64-bit Windows: The key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0. – VISHVAMBRUTH J T Nov 05 '16 at 22:56
  • When I run the above code I'm not getting any error in eclipse the script shows as passed. But the script fails to click on the 'Sign In' link. Can you please share your code which worked for you. – VISHVAMBRUTH J T Nov 05 '16 at 23:32
  • If you un-comment the sending of the keys, are you getting an error then? Because if you don't see any errors, something must be wrong with your instance. My code was almost the same, just in python, unfortunately I don't have it anymore. – pagep Nov 06 '16 at 04:50