I am trying a build an automated testing framework, using Selenium WebDriver to simply login a website.
However, when I run the following code, the only thing that happens is a new internet explorer window pops up stating "This is the initial start page for the WebDriver server."
My code:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class WebSeleniumClient {
public static void main(String[] args){
File file = new File("C:\\Users\\Picheal\\Desktop\\Selenium Web Driver\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
// Creates InternetExplorer Driver
WebDriver driver = new InternetExplorerDriver();
//Opens Login
for (int i = 0; i <= 500; i++){
driver.get("https://ams2.enoah.com/Home/Login?returnurl=%2f");
System.out.println(i);
}
// Finds login form and inputs credentials
WebElement user = driver.findElement(By.id("dnn_ctr780_Login_Login_JLSystems.NOAH_txtUsername"));
WebElement pass = driver.findElement(By.id("dnn_ctr780_Login_Login_JLSystems.NOAH_txtPassword"));
user.sendKeys("********");
pass.sendKeys("********");
}
}
My console looks like:
Started InternetExplorerDriver server (64-bit)
2.47.0.0
Listening on port 63771
I usually don't ask questions but this is a just strange behavior. I believe this may be an error in eclipse. I deleted all my code, saved, and ran the same again, and still I got the same result - a new internet explorer window only.
-
duplicate of sqa.stackexchange.com/questions/3513/…demouser123– demouser1232015年08月21日 05:46:30 +00:00Commented Aug 21, 2015 at 5:46
3 Answers 3
The issue is with the IE versions, your machine should be having both IE versions i.e. 32-bit and 64-bit and when you start the 'IEDriverServer.exe' it calls the 64-bit IE version while you are using 32-bit IEDriverServer.exe. I faced this issue too and observed that when any tool starts IE then 64-bit IE is launched by default (I was on Windows 7 and IE-9), because they pick default settings of the system which is usually 64-bit.
So either make 32-bit Internet Explorer default or download the 64-bit IEDriverServer.exe from Selenium Downloads and use the same.
For making 32-bit IE as default refer this link 32-bit Default IE
If test is running successfully on other browser then there is configuration issue of IE on machine.
Make sure version of Selenium, IE driver and IE browser are compatible Ref. selenium release log
Also verify required configure mentioned here
user.sendkeys("""")
won't work because type WebElement does not allow string arguments.
Other than that this works perfect in my system (Win7 64 bit).
You can try:
- Check the versions of your Eclipse and IEDriver to check whether they are 32/64 bit as others have said here.
- Try using Capabilities class for your IEDriver.
-
why the down vote? is it because I havent typed it ''neatly''. lol..this community. I am so tired.Tester_4fun– Tester_4fun2016年02月19日 10:41:26 +00:00Commented Feb 19, 2016 at 10:41
-
All I missed was some spaces, i think. I am no longer going to post anything until i feel its abs necessaryTester_4fun– Tester_4fun2016年02月19日 10:43:50 +00:00Commented Feb 19, 2016 at 10:43
-
You haven't really explained how the Capabilities class will help the poster. I've cleaned up your format and grammar a bit to make your answer a bit easier to understand, but you really need to show how your suggestions will help: indicate what the OP should be doing instead of
WebElement.SendKeys("*****")
and give an example of using the Capabilities class.Kate Paulk– Kate Paulk2016年02月19日 12:48:05 +00:00Commented Feb 19, 2016 at 12:48
Explore related questions
See similar questions with these tags.