如果我在pom文件中使用以下内容,我应该在哪里放置IEdriver.exe快速提问
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-ie-driver</artifactId>
<version>2.46.0</version>
</dependency>
我是否需要将.exe驱动程序粘贴到特定路径中?或者Maven会自动执行此操作,然后我可以访问此路径来定义路径
capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(CapabilityType.VERSION, "10");
System.setProperty("webdriver.ie.driver", GET THE MAVEN PATH);
driver = new InternetExplorerDriver(capabilities);
目前我的回购中有IED驱动程序和Chrome驱动程序,但我不确定在那里有两个exe文件是否合适。
此致
答案 0 :(得分:0)
将IEDriver和Chrome驱动程序放在目录中,然后在程序中指定它们,如下所示:
protected void populateDDL()
{
var item = new List<ListItem>
{
new ListItem("", ""),
new ListItem("Yellow Snake", "9.0"),,
new ListItem("This item works", "12.1"),
new ListItem("Pink Water Buffalo", "9.2"),
};
this.dropdownlistone.DataTextField = "Text";
this.dropdownlistone.DataValueField = "Value";
this.dropdownlistone.DataSource = item;
this.dropdownlistone.DataBind();
}
String[] stringsplit = dropdownlistone.SelectedValue.ToString().Split('.');
String itemprice = stringsplit[0].Trim();
答案 1 :(得分:0)
使用selenium独立服务器插件:
https://github.com/Ardesco/selenium-standalone-server-plugin
您可以像这样将它添加到POM中:
<plugins>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
<version>1.0.7</version>
<configuration>
<!-- root directory that downloaded driver binaries will be stored in -->
<rootStandaloneServerDirectory>/my/location/binaries</rootStandaloneServerDirectory>
<!-- Where you want to store downloaded zip files -->
<downloadedZipFileDirectory>/my/location/zips</downloadedZipFileDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>selenium</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
它将下载驱动程序二进制文件并设置Selenium期望的系统属性。
您需要定义自己的RepositoryMap.xml,详细说明要下载的驱动程序二进制文件。
这里有一个有效的例子: