Java 为什么Selenium服务器没有';找不到定位器

Java 为什么Selenium服务器没有';找不到定位器,java,selenium,web-testing,Java,Selenium,Web Testing,我没有通过Eclipse/Java/Selenium服务器2找到定位器 Object el = findElement( "//table[@id='global_list']//tr//td[2]//a[text()='mytext']" ); //==> return null String deb = findElement( "//table[@id='global_list']//tr//td[2]" ).getText(); //==> return 'mytext'

我没有通过Eclipse/Java/Selenium服务器2找到定位器

Object el = findElement( "//table[@id='global_list']//tr//td[2]//a[text()='mytext']" );
//==> return null
String deb = findElement( "//table[@id='global_list']//tr//td[2]" ).getText();
//==> return 'mytext'
我通过FireFox上的firepath扩展发现定位器成功。 我做错了什么

driver.findElement(By.xpath("//table[@id='global_list']//tr//td[2]" )).click()
试试这个

String textElem=driver.findElement(By.xpath("//table[@id='global_list']//tr//td[2]" )).getText()
还是这个

driver.findElement(By.xpath("//*/a[contains(text(),'blablabla')])").click()
我的项目中的蓄水清单:

POM.xml中的依赖项列表

 <dependencies>
<!--
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
-->
      <dependency> <groupId>org.seleniumhq.selenium</groupId>
          <artifactId>selenium-java</artifactId>
          <version>2.24.1</version>
      </dependency>

      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-core</artifactId>
          <version>3.0.0.RELEASE</version>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-expression</artifactId>
          <version>3.0.0.RELEASE</version>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-beans</artifactId>
          <version>3.0.0.RELEASE</version>
      </dependency>
      <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-context</artifactId>
          <version>3.0.0.RELEASE</version>
      </dependency>

      <!--<dependency>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
          <version>1.2.4</version>
          <scope>test</scope>
      </dependency>
-->
      <dependency>
          <groupId> org.apache.cassandra</groupId>
          <artifactId>cassandra-all</artifactId>
          <version>0.8.1</version>
      </dependency>

      <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
          <version>1.6.6</version>
      </dependency>
      <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>jcl-over-slf4j</artifactId>
          <version>1.6.6</version>
          <scope>runtime</scope>
      </dependency>
      <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>jul-to-slf4j</artifactId>
          <version>1.6.6</version>
          <scope>runtime</scope>
      </dependency>
      <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>log4j-over-slf4j</artifactId>
          <version>1.6.6</version>
          <scope>runtime</scope>
      </dependency>
      <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.8.2</version>
      </dependency>

  </dependencies>

org.seleniumhq.selenium
硒爪哇
2.24.1
org.springframework
弹簧芯
3.0.0.1版本
org.springframework
弹簧式
3.0.0.1版本
org.springframework
春豆
3.0.0.1版本
org.springframework
spring上下文
3.0.0.1版本
org.apache.cassandra
卡桑德拉
0.8.1
org.slf4j
slf4j api
1.6.6
org.slf4j
jcl-over-slf4j
1.6.6
运行时
org.slf4j
七月至六月
1.6.6
运行时
org.slf4j
log4j-over-slf4j
1.6.6
运行时
朱尼特
朱尼特
4.8.2

希望现在这对您有用

请提供html以查看发生了什么。我应该在项目中为“驱动程序”和“按”可见性包括什么?