小编cbo*_*non的帖子

Selenium WebElement xpath Java

我试图浏览一个带有xpath的网页,我想出了一些混合的结果.这就是我正在使用的:

driver.findElement(By.xpath("//div[contains(@class, 'x-grid3-cell-inner x-grid3-col-0')]"));
Run Code Online (Sandbox Code Playgroud)

这实际上很好,但我遇到的问题是:

<div class="x-grid3-cell-inner x-grid3-col-0" unselectable="on">92300</div>
<div class="x-grid3-cell-inner x-grid3-col-0" unselectable="on">92475</div>
<div class="x-grid3-cell-inner x-grid3-col-0" unselectable="on">92476</div>
<div class="x-grid3-cell-inner x-grid3-col-0" unselectable="on">92301</div>
<div class="x-grid3-cell-inner x-grid3-col-0" unselectable="on">92474</div>
Run Code Online (Sandbox Code Playgroud)

当我在Selenium测试中运行xpath时,我总是得到第一个div.如何编辑我的xpath以检索第4个div(92301)或其他不是列表中第一个div的div?

java xml selenium xpath

5
推荐指数
1
解决办法
3439
查看次数

wsimport 两个声明导致冲突

我正在尝试在https://api.sendwordnow.com/webservices/v3/users.svc?wsdl上使用 wsimport 。这是我正在使用的 wsimport。

wsimport -B-XautoNameResolution -d C:\temp -extension -J-Djavax.xml.accessExternalSchema=all -J-Djavax.xml.accessExternalDTD=all -keep -verbose -XadditionalHeaders -Xnocompile https://api.sendwordnow.com/webservices/v3/users.svc?wsdl
Run Code Online (Sandbox Code Playgroud)

这是错误。

解析 WSDL...

    [WARNING] unknown extensibility element or attribute "EndpointReference" 
    (in namespace "http://www.w3.org/2005/08/addressing") line 1 of 
    https://api.sendwordnow.com/webservices/v3/users.svc?wsdl
    [ERROR] Two declarations cause a collision in the ObjectFactory class. 
    line 1 of https://api.sendwordnow.com/webservices/v3/Users.svc?xsd=xsd3
    [ERROR] (Related to above error) This is the other declaration. 
    line 1 of https://api.sendwordnow.com/webservices/v3/Users.svc?xsd=xsd3
    [ERROR] Two declarations cause a collision in the ObjectFactory class. 
    line 1 of https://api.sendwordnow.com/webservices/v3/Users.svc?xsd=xsd2
    [ERROR] (Related to …
Run Code Online (Sandbox Code Playgroud)

java xml xsd soap web-services

5
推荐指数
1
解决办法
5731
查看次数

IntelliJ Maven硒构建罐

我正在使用IntelliJ 12,Java 7,Selenium 2.31.0和Maven。我可以在IDE之外运行测试,但尝试创建jar文件时遇到问题。我可以创建jar文件,双击mvn clean,然后双击安装。一切都很好,罐子就创建了。当我通过命令行运行jar时,会发生问题。

java -jar xyz-selenium-test-1.0.jar

返回:线程“主”中的异常java.lang.NoClassDefFoundError:org / openqa / selenium / WebDriver

我在项目设置中将selenium-server-standalone-2.31.0.jar添加为库,并在项目设置中将其添加为依赖模块。我必须在pom文件中丢失某些内容,但我只是不知道它是什么。我还附加了我的pom文件。

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xyz.selenium.test</groupId>
<artifactId>xyz-selenium-test</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>xyz-selenium-test</name>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.31.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.31.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>2.31.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>selenium-jar</groupId>
<artifactId>selenium-server-standalone-2.31.0.jar</artifactId>
<version>2.31.0</version>
<scope>system</scope>
<systemPath>/usr/local/selenium/selenium-server-standalone-2.31.0.jar</systemPath>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.31.0</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.0</version> …
Run Code Online (Sandbox Code Playgroud)

java selenium jar intellij-idea maven

0
推荐指数
1
解决办法
2073
查看次数

标签 统计

java ×3

selenium ×2

xml ×2

intellij-idea ×1

jar ×1

maven ×1

soap ×1

web-services ×1

xpath ×1

xsd ×1