Problem with IE browser

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with IE browser

Ashwin
Hi,

I am able to lunch the IE browser and able to get the URL i am using webdriver, but it gets failed in the loginpage. Not able to find the loginname locator.

I am getting the following error message

org.openqa.selenium.NoSuchElementException: Unable to find element with name == loginname (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.03 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.19.0', revision: '15848', time: '2012-02-08 16:25:03'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_20'
Driver info: driver.version: RemoteWebDriver
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:170)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:123)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:439)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:226) atorg.openqa.selenium.remote.RemoteWebDriver.findElementByName(RemoteWebDriver.java:275)
        at org.openqa.selenium.By$ByName.findElement(By.java:292)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:218)

Thanks,
Ashwin
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

softwaretestingforum
Administrator
Could you post short html of application and your test code?
Looks like you have not used right locator.
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser


driver.findElement(By.name("loginname")).sendKeys("ABC");
driver.findElement(By.name("password")).sendKeys("ABC12@g");
driver.findElement(By.name("Submit")).click();
               
Ashwin
This is the sample HTML and test code

<input class="InputText" type="text" size="20" name="loginname">
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

softwaretestingforum
Administrator
Don't see any thing obviously wrong.
Now I would have to ask you more test code, like - how you launching the URL, how are test configured etc.
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

Ashwin
please find the below sample code. The same code is working fine in Chrome and Firefox driver

private WebDriver driver;
private String baseUrl;
       
@BeforeTest
public void setUp() throws Exception {
baseUrl = "http://localhost/";
driver = new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

@Test
public void test() {
   driver.get(baseUrl + "/");
   driver.findElement(By.name("loginname")).sendKeys("abc");
   driver.findElement(By.name("password")).sendKeys("abc123");
   driver.findElement(By.name("Submit")).click();
}

@AfterTest
public void tearDown(){
  driver.quit();
}

Thanks,
Ashwin


       
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

softwaretestingforum
Administrator
I hope the application URL is -

baseUrl = "http://localhost/";

Also which version of IE are you using? And can your try with latest Selenium jar which is version 2.21, I observed that you are using 2.19
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

Ashwin
Hi Tarun,

yes baseUrl is the application url, i am using IE 7 and i have tried with Selenium 2.21.0 version still i am having the same problem.

Thanks,
Ashwin
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

softwaretestingforum
Administrator
Could you comment this line -

   driver.findElement(By.name("loginname")).sendKeys("abc");

just to debug if password field is recognized.
Also can you use IE developer tool bar to find if name is really - "loginname" in IE too. (Sounds dumb but yet could you check this?)
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

Ashwin
Yes in IE also locator name is same "loginname" It launches the URL and redirects to login page but it is not identifying the locator elements. i commented loginname part and tried with password still its not identifying and with Login button also its not working.

I think after the url is invoked page focus is not recognized for login page i guess.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

softwaretestingforum
Administrator
after - driver.get()
can you do -

System.out.println(driver.getPageSource())

And check if it prints desired elements.
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

Ashwin
I am able get the page source it means its recognizing the login page but after that i am getting the same error

org.openqa.selenium.NoSuchElementException: Unable to find element with name == loginname (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.14 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.2.1', revision: '16551', time: '2012-04-11 21:42:35'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_20'
Driver info: driver.version: RemoteWebDriver
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:175)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:128)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:459)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:227)
        at org.openqa.selenium.remote.RemoteWebDriver.findElementByName(RemoteWebDriver.java:288)
        at org.openqa.selenium.By$ByName.findElement(By.java:292)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:219)
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
        at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

softwaretestingforum
Administrator
What source code is printed ? Could you post it here while masking ant sensitive information?
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

Ashwin
Hi Tarun,

Finally i am able fix the issue there was some IE proxy setting issue.

Sorry for pulling your time.

Thanks a lot for the help :)
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

softwaretestingforum
Administrator
No problem, but could you please explain for others benefit as how you fixed it?
~ seleniumtests.com
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IE browser

Ashwin
Solution to run the script from IE:

Under Tools -> Internet options -> Connections -> LAN settings -> un check Automatic configurations if any check box is selected.