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 |
Administrator
|
Could you post short html of application and your test code?
Looks like you have not used right locator.
~ seleniumtests.com
|
This is the sample HTML and test code
<input class="InputText" type="text" size="20" name="loginname"> | driver.findElement(By.name("loginname")).sendKeys("ABC"); driver.findElement(By.name("password")).sendKeys("ABC12@g"); driver.findElement(By.name("Submit")).click(); |
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
|
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 |
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
|
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 |
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
|
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. |
Administrator
|
after - driver.get()
can you do - System.out.println(driver.getPageSource()) And check if it prints desired elements.
~ seleniumtests.com
|
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) |
Administrator
|
What source code is printed ? Could you post it here while masking ant sensitive information?
~ seleniumtests.com
|
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 :) |
Administrator
|
No problem, but could you please explain for others benefit as how you fixed it?
~ seleniumtests.com
|
Free forum by Nabble | Edit this page |