Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

NoSuchElementException in IE7 when attempting to Find a WebElement By ID #3032

Closed
lukeis opened this issue Mar 3, 2016 · 34 comments
Closed

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 3032

A "NoSuchElementException" is being thrown when attempting to locate a WebElement by
id when using IE7 to execute "findElement(By.id("id"))".

This problem does not occur in Firefox 8 and Chrome 15.0.874.121 (using Chrome driver
16.0.902.0).  IE8 and IE9 were not tested.

What steps will reproduce the problem?
1. Execute the following code:

  WebDriver driver = new InternetExplorerDriver();
  driver.get("http://www.google.com");
  WebElement googleInput = driver.findElement(By.id("lst-ib"));

What is the expected output? What do you see instead?

  I expect the WebElement to be located by it's id, instead a NoSuchElementException
is being thrown.


Selenium version: 2.0.15
OS: Windows XP SP3
Browser: IE
Brower version: 7

Exception

org.openqa.selenium.NoSuchElementException: Unable to find element with id == browserNameTextBoxID
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 312 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.15.0', revision: '15105', time: '2011-12-08 12:59:39'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version:
'1.6.0_29'
Driver info: driver.version: RemoteWebDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:147)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:113)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:424)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:210)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:227)
    at org.openqa.selenium.By$ById.findElement(By.java:216)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:202)
    at com.vesta.qa.vtf.uiinterface.TestVTFWithIE.test_getWebDriver_IE_Poitive_001_Explicit_Driver(TestVTFWithIE.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
    at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
    at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
    at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
    at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
    at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
    at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
    at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
    at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
    at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


Console Ouptut

Dec 8, 2011 2:15:40 PM org.openqa.selenium.remote.RemoteWebDriver execute
INFO: Executing: [null, newSession {"desiredCapabilities":"Capabilities [{platform=WINDOWS,
ensureCleanSession=true, browserName=internet explorer, version=}]"}]
Dec 8, 2011 2:15:41 PM org.openqa.selenium.remote.RemoteWebDriver execute
INFO: Executing: [314e2f8c-4298-4f1f-be30-bbb6d1a50b8e, get {"url":"http://www.google.com"}]
Dec 8, 2011 2:15:42 PM org.openqa.selenium.remote.RemoteWebDriver execute
INFO: Executing: [314e2f8c-4298-4f1f-be30-bbb6d1a50b8e, findElement {"using":"id","value":"lst-ib"}]


Reported by rywdavis1 on 2011-12-08 22:29:48

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

What happens when you put a delay between the call to get() and the call to findElement()?
Given that the Google search page uses a fair amount of AJAX, the element may not yet
actually exist in the DOM when you attempt to find it. 

Reported by james.h.evans.jr on 2011-12-08 23:16:21

  • Status changed: NeedsClarification

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I have tried adding a delay between the call to get() and findElement().  The reason
I selected the google page was to demonstrate the problem in a web site that everyone
would have easy access to.

This code was last observed working on 11/18/2011 using Selenium WebDriver 2.12.0 and
IE7.

Things I have tried

    1. Re-started computer
    2. Reverted Maven Project dependency back to Selenium 2.12.0 and executed test code
(maven and eclipse clean)
    3. Created a new Maven Project with only Selenium 2.12.0 and executed test code
    4. Created a new Maven Project with only Selenium 2.15.0 and executed test code
    5. Deleted and Re-created Maven Repository org.sleniumhq folder, having Maven download
Webdriver again
    6. Reset IE7 settings and executed test code
    7. Removed IE Security update 2586448, restarted and executed test code
    8. Re-installed Java 1.6.0 29 and executed test code

I am suspecting an environment/configuration isssue as this seems like a very basic
test case that if failing for everyone would be reported by others.

Reported by rywdavis1 on 2011-12-09 01:08:20

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I am seeing the same issue. I started with version 2.11.0, saw the issue. Then installed
2.15.0, still seeing the issue.

Reported by bhavanak on 2011-12-17 01:54:55

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I have not found a resolution for this issue that I reported 11 days ago, however I
do have a bit more information.

A Recap

On 11/18/2011 I executed tests using WebDriver 2.12.0 and the IE7 instance on my computer.
 On 12/8/2011, I upgraded my WebDriver version to 2.15.0 and the same tests were no
longer able to locate WebElements using the same instance of IE7 on my computer.  After
downgrading to 2.12.0 I was still unable to locate WebElements using IE7.  This code
fails on all internal and external -hosted web applications, and even on a hard-coded
html file on my local hard drive.

This information leads me to believe that the problem may be caused by an environment
change on my company’s network, possible one or a combination of the following:
  1.    A recent Windows Security update 
  2.    A recent Internet Explorer update
  3.    A IE7 Browser Security setting had changed because of a Windows Group Policy Change

Our IT department indicates that no change of this nature should have occurred within
the time frame of the emergence of this issue.  I have not eliminated this as a possibility.

I am currently unable to locate WebElements by id, name, css, classname nor XPath when
using IE7 with WebDriver 2.12.0.  I am able to retrieve the URL and Page title, attempting
to retrieve the page source however, returns an empty String.

I created a test .jar file that attempts to use WebDriver 2.12.0 to open Google and
locate the WebElement with the id “lst-ib”.  The test program indicates Pass if the
WebElement can be found, otherwise it indicates Failure.   I have had co-workers execute
this .jar file and it is clear the problem is not limited to my computer. 

This issue occurs in all instances of IE7 on my company’s network and about 1/2 of
the IE8 instances.  I have been unable to find a common configuration on the computers
on which the test .jar fails.

I would appreciate any suggestions as this problem has severely derailed our automated
testing in IE.

Reported by rywdavis1 on 2011-12-19 17:47:42

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I get exactly the same problem with 2.15.0
I now can't use the internetexplorerdriver() at all in our automated test suite - ff8
remains fine.

Reported by richard.dickinson@ca.com on 2012-01-09 15:17:47

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Here's my failing test case.

Reported by richard.dickinson@ca.com on 2012-01-09 15:40:05


- _Attachment: [Test.zip](https://storage.googleapis.com/google-code-attachments/selenium/issue-3032/comment-6/Test.zip)_

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This is still occurring with v2.16.1.
I am using ie8 x64.

Reported by richard.dickinson@ca.com on 2012-01-10 09:26:22

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi,

I get the same issue with Selenium 2.17.0, 2.18.0 and 2.19.0, and IE (32bits).

I'm testing a local GWT webapp; after the 'get' call i added this:
(new WebDriverWait(driver, 10)).until(new ExpectedCondition<WebElement>(){
    @Override
    public WebElement apply(WebDriver d) {
        System.out.println("Searching...");
        return d.findElement(By.id("lastName"));
    }});

I always get a timeout error with IE; with FF all works fine.

If you need more information, let me know.

Reported by vincent.nap on 2012-02-15 15:52:01

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Sorry, i forgot to mention my IE version: IE 7.0.5730.13 on XP Pro 2002 SP3 (corporative
version, so maybe with security patches).

I revert my Selenium version back to 2.1.0, and this still does not work. So i think
rywdav is right, something in the execution environment are going wrong :-/

Reported by vincent.nap on 2012-02-16 09:26:55

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I tried the remote driver (and the InternetExplorerDriver_Win32_2.19.0.zip, available
in the "Downloads" section) and got the same behavior.

Reported by vincent.nap on 2012-02-16 10:31:38

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Any work around or exact the root cause for this issues. This is really night mare troubling
our automation in IE. Please assist us...

Reported by skrn1201 on 2012-02-17 06:20:11

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This is not globally broken. There are tests in the WebDriver unit tests that find elements
by ID, and these have been run successfully on IE 6, 7, 8, and 9. Without a full reproduction
case, including HTML or public URL to reproduce against, it will be impossible to determine
a root cause. I am able to locate elements on google.com. The test case supplied by
one of the commenters was proven to be resolved by using IDs that do not start with
numbers. 

Reported by james.h.evans.jr on 2012-02-17 21:04:06

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi All,

I faced the same issue and finally resolved it.

Issue is due to testing url added as exception to by pass proxy settings.

Solution :
In Internet Explorer, Go to

Tools->Internet Options->Connections->LAN Settings

In Proxy server, click Advanced button

In Exceptions, check whether the testing url for which proxy server has to be bypassed
is included. If so remove it and execute the test case.

This resolves me the issue. I tested in both IE 7 and IE 8 and it works for me.

Reported by abalaji.86 on 2012-02-22 14:19:30

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Thanks for the workaround, abalaji!

I disabled all proxy settings in my registry (BE CAREFUL: http://support.microsoft.com/kb/2289942/en-us)
in spite of my server address is 'localhost', and my test work fine.

It would be nice if IE driver can do something about this.

Reported by vincent.nap on 2012-02-23 09:39:45

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi,

Even i am facing the same issue. I am unable to click on the link which is having the
proper html Id. when i am trying to find the element by id it's giving an error saying
that "Unable to find element with id ==overridelink". Please see the screen shot of
the page which is Certificate Error page.
IE version: IE8 (8.0.6001.18702co)
OS : XP
Selenium version: 2.16.0 (dotnet)

Regard's
Sai baba

Reported by alladi.sai on 2012-03-06 07:01:33


- _Attachment: [CertificateError.JPG](https://storage.googleapis.com/google-code-attachments/selenium/issue-3032/comment-15/CertificateError.JPG)_

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi,

Check for the frame in which the id ==overridelink is found.

If it is in different frame other than parent frame, then you need to switch to that
frame using <webdirver_instance>.switchTo().frame(<fame_name>); before finding any
elements on it.

Regards,
Balaji

Reported by abalaji.86 on 2012-03-08 07:50:30

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hello 

I have the same issue, but the problem is when the element to find is inside a frame.
I switched to frame before, the url changes to the frame url, but no pagesource and
can't find any web element with any selector.

only one frame

<HTML><HEAD><TITLE>INTRANET TEXTURA INTERIORS</TITLE></HEAD><FRAMESET frameSpacing=0
border=0 frameBorder=0 rows=80,100%><FRAME noResize src="/textura/portal/portal.nsf/TEXTURATitulo?readForm"
frameBorder=0 name=Superior scrolling=no><FRAME noResize src="/textura/portal/portal.nsf/Workplace?ReadForm"
frameBorder=0 name=Inferior scrolling=yes></FRAMESET>

the code


driver.switchTo().frame("Superior");

WebElement enlace = driver.findElement(By.partialLinkText("Registro");
enlace.click();


I also tried Thread.sleep and more implicitwait with no result

versions:
ie 8.0.6001.18702
windows xp 32bits
selenium 2.20.0 , 2.21.0

Reported by mrlops on 2012-04-18 21:06:47

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I am facing the same issue with alladi....@gmail.com. I am unable to click on the link
which is having the proper html Id. when i am trying to find the element by id it's
giving an error saying that "Unable to find element with id ==overridelink". With 'name'
or 'class' or 'a' or other properties , the result is the same.
IE version: IE7/IE8 
OS : XP/Win7
Selenium version: 2.24.0 (dotnet)

jacky

Reported by zhanqiao123 on 2012-08-22 10:41:59

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

dear , I find an solution of my issue and 15F
set IE option - tools - Internet - Advanced - Security - 'Allow active content to run
in files on my computer' ,this option must be selected.

Reported by zhanqiao123 on 2012-08-27 07:42:46

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi Guys,

I am using IE9 , And my test case is very simple, but I am getting this 
org.openqa.selenium.NoSuchElementException: Unable to find element with id 

Please help

Reported by mabini.roberto on 2012-10-30 14:31:45

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi All

Here the detail of the issue that I am trying to solve.

I am doing a test for IE9, selenium 2.5, java 6, maven 3.0

I have done the following or here is the code see below. I hope that this get resolve.
or Please send me a working test for IE 9. Thanks A lot and More power 


package com.slr.sample;

import java.io.File;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;

public class GoogleSuggest {
    public static void main(String[] args) throws Exception {
        // The Firefox driver supports javascript
        File file = new File("C:\\Users\\30106331\\Downloads\\IEDriverServer_x64_2.25.3\\IEDriverServer.exe");
        System.setProperty("webdriver.ie.driver", file.getAbsolutePath());

        WebDriver driver = new InternetExplorerDriver();

        // Go to the Google Suggest home page
        driver.get("http://www.google.com/webhp?complete=1&hl=en");

        // Enter the query string "Cheese"
        WebElement query = driver.findElement(By.name("q"));
        query.sendKeys("Cheese");

        // Sleep until the div we want is visible or 5 seconds is over
        long end = System.currentTimeMillis() + 5000;
        while (System.currentTimeMillis() < end) {
            WebElement resultsDiv = driver.findElement(By.className("gssb_e"));

            // If results have been returned, the results are displayed in a
            // drop down.
            if (resultsDiv.isDisplayed()) {
                break;
            }
        }

        // And now list the suggestions
        List<WebElement> allSuggestions = driver.findElements(By
                .xpath("//td[@class='gssb_a gbqfsf']"));

        for (WebElement suggestion : allSuggestions) {
            System.out.println(suggestion.getText());
        }
    }
}

Here is the result




Started InternetExplorerDriver server (64-bit)
2.25.3.0
Listening on port 19280
Oct 31, 2012 2:05:37 AM org.apache.http.impl.client.DefaultRequestDirector tryExecute
INFO: I/O exception (java.net.SocketException) caught when processing request: Software
caused connection abort: recv failed
Oct 31, 2012 2:05:37 AM org.apache.http.impl.client.DefaultRequestDirector tryExecute
INFO: Retrying request
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find
element with name == q (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 312 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version:
'1.6.0_37'
Driver info: driver.version: RemoteWebDriver
Session ID: 1fe2afbb-ceb1-4512-8363-122112698665
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:498)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:268)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByName(RemoteWebDriver.java:329)
    at org.openqa.selenium.By$ByName.findElement(By.java:291)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:260)
    at com.slr.sample.GoogleSuggest.main(GoogleSuggest.java:23)



Reported by mabini.roberto on 2012-10-30 18:12:35

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi Guys,

I would like to add additional information regarding this defect, this only happens
in IE7. This work perfecly in XP  

Reported by mabini.roberto on 2012-11-06 06:41:59

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

To be more specific and clear ---  the above comment mean the Issue is only with respect
to IE7. But not in other Versions of IE which run on XP machine. 

Reported by praveen.kumar1254 on 2012-11-15 17:03:31

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi, I have the same problem.

When I search on google it works fine on IE8, FF16 and Chrome, but when I try find
an intranet element it only works on FF16 and Chrome, and not on IE8 (It can't find
anything)
I tried to search the element by ID, classname, name, xpath... I'm currently using
Visual Studio 2010 and Selenium with Web Driver. Here is some code:

static IWebDriver driver = new InternetExplorerDriver(@"C:\SeleniumVS\seleniumItems");
driver.Navigate().GoToUrl("url");
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));

public void run() {
myWait.Until(ExpectedConditions.ElementIsVisible(By.Id("userlogin"))).SendKeys("UserName");

How can I get this running on IE8?
Thx

Reported by chendo89 on 2012-11-27 10:24:42

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I'm closing this issue because it's a pile of various complains and questions, nothing
actionable here. We have a regression test suite that runs on IE 6, 7, 8, 9 and 10
to make sure that things are not globally broken. If you have an issue with a specific
page first ask for help on the user list. If you get no help from the community then
please raise a new issue and provide a reproduction scenario.

Reported by barancev on 2012-12-11 23:17:25

  • Status changed: WontFix

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Why do you close the issue? 

I have the same problem: IE9 loads page, displays the right content, page_source contains
element i'm looking for. But if i call find_element_by_css_selector, NoSuchElementException
raises.

Reported by WarmAndSunnyDay on 2012-12-19 12:33:25

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

@WarmAndSunnyDay: Please raise a new issue and provide a reproduction scenario and a
sample page. And please make sure that you use the latest versions of Selenium and
IEDriverServer (2.28 at the moment).

Reported by barancev on 2012-12-19 12:40:49

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi, I have the same problem
has anyone found a solution?

I run (python)

e = webdriver.Ie()
e.get("http://google.com")
e.find_element_by_xpath('html/body')


It works for me on IE9 on windows 7 
but when i run it on windows server 2008 R2 it returns
 Message: u'Unable to find element with xpath == html/body'

Thanks in advance

Reported by levkad on 2013-01-06 15:24:01

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

I also had this problem, uninstalling and re-installing IE7 fixed it for me.

Reported by ian.is.bigwave on 2013-04-24 12:24:35

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

For those running Windows Server 2012, IE is set up by default with Enhanced Security
Settings, you must disable this to solve this issue, as it worked for me.

Step 1: Open Server Manager
Step 2: Click on Local Server
Step 3: Scroll right and look for IE Enhanced Security Confuguration setting
Step 4: Click on "on"
Step 5: Turn this setting to off 

Re run your tests and it should be all good for errors like NoSuchElement

Reported by sfarooq@sugarcrm.com on 2014-02-10 23:53:35

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

"For those running Windows Server 2012, IE is set up by default with Enhanced Security
Settings, you must disable this to solve this issue, as it worked for me.

Step 1: Open Server Manager
Step 2: Click on Local Server
Step 3: Scroll right and look for IE Enhanced Security Confuguration setting
Step 4: Click on "on"
Step 5: Turn this setting to off/"

>> Thank you so much. It helped me in my similar problem.


Reported by maxim.kim.1986 on 2014-03-20 09:17:01

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi,
i am using the attached code.
it's working fine on Chrome and Firefox but hitting the below error for IE.

W17:30:30:422 .\IEThread.cpp(698) Unable to locate eval method
W17:30:30:594 .\IEThread.cpp(698) Unable to locate eval method
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find
element by xpath: //div/div[1]/div[2]/div[8]
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0',
time: '2014-09-10 09:43:55'
System info: host: 'NODHCMSLTP1770', ip: '10.237.212.166', os.name: 'Windows 7', os.arch:
'amd64', os.version: '6.1', java.version: '1.7.0_71'
Driver info: driver.version: InternetExplorerDriver
    at org.openqa.selenium.ie.Finder.findElementByXPath(Finder.java:186)
    at org.openqa.selenium.By$ByXPath.findElement(By.java:357)
    at org.openqa.selenium.ie.Finder.findElement(Finder.java:207)
    at org.openqa.selenium.ie.InternetExplorerDriver.findElement(InternetExplorerDriver.java:301)
    at com.regression.testsuite.practice.test.practice.TestGannet.main(TestGannet.java:22)

can anyone please help me.
i think that is because of using xpath locator.
is there any way so that xpath can support on IE


Reported by dubey.pradeep15 on 2014-11-18 13:02:41


- _Attachment: [code.txt](https://storage.googleapis.com/google-code-attachments/selenium/issue-3032/comment-33/code.txt)_

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Hi Folks. I have a similar problem with firefox. I am getting error  org.openqa.selenium.NoSuchElementException.
I use firefox version 24 but i tried also version 33. I have tried to install and uninstall
several eclipse versions such as luna and kepler. I have compared the setting of my
eclipse and jars with other colleagues but only i am getting this error. No one knows
how to help me and i have spent already 2 days with sorting this staff out. Please,
if there is any chance to help me. Thanks a million. The full error message is :
=========================================
 Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate
element: {"method":"link text","selector":"Add New"}
Command duration or timeout: 45 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: 'KEMP-MCrkon2', ip: '10.0.30.49', os.name: 'Windows 7', os.arch:
'amd64', os.version: '6.1', java.version: '1.8.0_25'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true,
version=24.0, platform=XP, browserConnectionEnabled=true, nativeEvents=true, acceptSslCerts=true,
webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true,
javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 0482325a-33c3-437b-9c8d-00dc8cf1812f
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:307)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByLinkText(RemoteWebDriver.java:356)
    at org.openqa.selenium.By$ByLinkText.findElement(By.java:248)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:299)
    at autoTest.WUI.Sandbox.main(Sandbox.java:60)
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to
locate element: {"method":"link text","selector":"Add New"}
Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12'
System info: host: 'KEMP-MCrkon2', ip: '10.0.30.49', os.name: 'Windows 7', os.arch:
'amd64', os.version: '6.1', java.version: '1.8.0_25'
Driver info: driver.version: unknown
    at <anonymous class>.FirefoxDriver.prototype.findElementInternal_(file:///C:/Users/MCRKON~1.KEM/AppData/Local/Temp/anonymous7866563845174350148webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8860)
    at <anonymous class>.FirefoxDriver.prototype.findElement(file:///C:/Users/MCRKON~1.KEM/AppData/Local/Temp/anonymous7866563845174350148webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8869)
    at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/MCRKON~1.KEM/AppData/Local/Temp/anonymous7866563845174350148webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10831)
    at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///C:/Users/MCRKON~1.KEM/AppData/Local/Temp/anonymous7866563845174350148webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10836)
    at <anonymous class>.DelayedCommand.prototype.execute/<(file:///C:/Users/MCRKON~1.KEM/AppData/Local/Temp/anonymous7866563845174350148webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10778)
========================================

the code i try to run is:
package autoTest.WUI;

import autoTest.lm;

import org.openqa.selenium.*; // The library that has Selenium
//import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.*;
import org.openqa.*;

import autoTest.Zephyr.ZephyrAPI;

public class Sandbox

{
    private static FirefoxDriver driver;

    public static void main(String[] args) throws Exception

    {



        Sandbox.driver = new FirefoxDriver(); // Opens up the Firefox browser,
                                                // set "Sandbox" class' driver
                                                // as Firefox
        driver.get("https://bal:2fourall@10.154.120.81"); // Go to LoadMaster
                                                            // 172.16.1.10(American
                                                            // ip here it was
                                                            // 10.89.200.89)
                                                            // with basic
                                                            // password
                                                            // bal/1fourall
        /*(new WebDriverWait(driver, 10)).until(new ExpectedCondition<WebElement>(){
            @Override
            public WebElement apply(WebDriver d) {
                System.out.println("Searching...");
                return d.findElement(By.id("lastName"));
            }});*/
        Thread.sleep(2000); // Wait 2 seconds for page to load
        String defaultFrame = driver.getWindowHandle(); // The default frame is
                                                        // saved in the variable
                                                        // "defaultFrame"
                                                        // This is the name of
                                                        // the frame that's
                                                        // automatically
                                                        // generated as soon as
                                                        // you enter the LM WUI
                                                        // This is not the same
                                                        // everytime, therefore
                                                        // have to save it for
                                                        // later use
        driver.switchTo().frame(0); // This switches control over to the left
                                    // menu frame, frame named "0"
        driver.findElement(By.xpath("/html/body/ul[2]/li/a/p/b")).click(); // Click
                                                                            // "Virtual Services"
                                                                            // by
                                                                            // using
                                                                            // it's
                                                                            // xpath
        driver.findElement(By.linkText("Add New")).click(); // Click "Add New"
                                                            // by using the
                                                            // "link text".
                                                            // That's
                                                            // identifying an
                                                            // element by the
                                                            // text that's
                                                            // enclosed in a
                                                            // link

        driver.switchTo().window(defaultFrame); // Move back to the default
                                                // frame
        driver.switchTo().frame("_bmain"); // Switch to the right panel frame
        Thread.sleep(2000);

        driver.findElement(By.id("Focus")).sendKeys("10.154.120.55"); // Send the
                                                                        // text
                                                                        // to
                                                                        // the
                                                                        // text
                                                                        // field
        driver.findElement(
                By.xpath("/html/body/div/form/table[2]/tbody/tr/td[2]/input"))
                .click(); // Click "Add this Virtual Service" button
        Thread.sleep(2000);

        // Now if were to add the same VS again, alert box should pop up telling
        // user that this VS already exist

        driver.get("https://bal:2fourall@10.154.120.72"); // Go to webpage again
        /*(new WebDriverWait(driver, 10)).until(new ExpectedCondition<WebElement>(){
            @Override
            public WebElement apply(WebDriver d) {
                System.out.println("Searching...");
                return d.findElement(By.id("lastName"));
            }});*/
        Thread.sleep(2000);
        driver.switchTo().frame(0); // Get to add new again
        driver.findElement(By.xpath("/html/body/ul[2]/li/p/a/b")).click();
        driver.findElement(By.linkText("Add New")).click();
        driver.switchTo().window(defaultFrame);
        driver.switchTo().frame("_bmain");

        driver.findElement(By.id("Focus")).sendKeys("10.154.120.66"); // Add the
                                                                        // same
                                                                        // VS
                                                                        // again
        driver.findElement(
                By.xpath("/html/body/div/form/table[2]/tbody/tr/td[2]/input"))
                .click();
        Thread.sleep(2000);

        // Alert box now tells user that the VS already exist

        driver.close(); // Close browser

    }

}
 Thanks a million, Miso

Reported by miso.crki on 2014-11-26 13:46:17

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:14:23

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant