小编Leo*_*arD的帖子

如何在Selenium WebDriver中设置可执行IE驱动程序的路径

我想在我的机器上运行以下代码(win XP&IE8)

public class bookie {                
  private WebDriver driver;        
  private String baseUrl;         
  private boolean acceptNextAlert = true;        
  private StringBuffer verificationErrors = new StringBuffer();        

  @Before    
  public void setUp() throws Exception {    
    DesiredCapabilities caps = DesiredCapabilities.internetExplorer();    
    caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);    
    driver = new InternetExplorerDriver(caps);     
    baseUrl = "http://book.theautomatedtester.co.uk/";     
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);    
  }

  @Test     
  public void testbookie() throws Exception {    
    System.setProperty("webdriver.ie.driver", "IEDriverServer.exe");    
    driver.get(baseUrl + "/");    
    driver.findElement(By.linkText("Chapter1")).click();    
    driver.findElement(By.id("radiobutton")).click();    
    new Select(driver.findElement(By.id("selecttype"))).selectByVisibleText("Selenium Core");    
    driver.findElement(By.linkText("Home Page")).click();     
    driver.findElement(By.linkText("Chapter2")).click();    
    driver.findElement(By.id("but1")).click();     
    driver.findElement(By.xpath("//input[@value='Sibling Button']")).click();     
    driver.findElement(By.linkText("Index")).click();      
    driver.findElement(By.linkText("Chapter1")).click();     
    new Select(driver.findElement(By.id("selecttype"))).selectByVisibleText("Selenium Grid");     
    driver.findElement(By.linkText("Home Page")).click();      
    driver.quit();
  }
Run Code Online (Sandbox Code Playgroud)

但我提供的堆栈跟踪是

java.lang.IllegalStateException:驱动程序可执行文件的路径必须由webdriver.ie.driver系统属性设置; org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:105)org.openqa.selenium.ie.InternetExplorerDriverService.access …

java internet-explorer selenium-webdriver

6
推荐指数
1
解决办法
3万
查看次数

Selenium网格提供例外:PROXY_REREGISTRATION

我现在能够成功运行selenium grid 2,感谢你们.现在我面临一个新问题,即:由于PROXY_REREGISTRATION,会话[xxxxx]被终止

根据我读到的,它表示节点已断开连接并正在重试连接到主机,但失败了.

但我想要的是,如何解决这个异常.而是如何处理它>> ??? 有谁知道这个相关的东西?

java selenium selenium-grid2

6
推荐指数
1
解决办法
1962
查看次数

有什么方法可以让我们从 catch 返回到 try 块

我在 Selenium webdriver 中运行代码,每当找不到元素时,它就会被捕获。但我希望 java 在跳过该元素后继续执行。

import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;

import net.sourceforge.htmlunit.corejs.javascript.ast.LabeledStatement;

import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

import com.gargoylesoftware.htmlunit.ElementNotFoundException;
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Label;
import com.sun.org.apache.bcel.internal.generic.GOTO;

public class try_zencart {
  private WebDriver driver;
  private String baseUrl;
  private boolean acceptNextAlert = true;
  private StringBuffer verificationErrors = new StringBuffer();

  @Before
  public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://ipadress/"; //I am providing an ip adress
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  }

  @Test
  public void testTryZencart() …
Run Code Online (Sandbox Code Playgroud)

java selenium selenium-webdriver

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