我正在创建一个程序来进入我的路由器并调整设置,并从不同的浏览器中进行,我有 FF、Chrome 和 IE 可以工作。我用 Opera 尝试的一切都行不通。它只打开两个选项卡,一个带有 127.0.0.1:some_crazy_port# 和 file:///C:/Users/EETEST~1/AppData/Local/Temp/opera4672404649060883314profile/ 当我试图到达时,192.168.0.1
系统:Windows 7:Eclipse Kepler & Selenium 2.37.0
这是我的代码:
import com.opera.core.systems.OperaDriver;
import com.thoughtworks.selenium.*;
import org.junit.Test;
import org.openqa.selenium.*;
import org.openqa.selenium.support.ui.Select;
public class NewTest extends SeleneseTestCase {
private WebDriver cDriver;
private String baseUrl;
public void setUp() throws Exception{
baseUrl = "192.168.0.1";//Heres the destination
System.setProperty("webdriver.opera.driver", "C:\\Program Files (x86)\\Opera");
cDriver = new OperaDriver();//Setting up the OperaDriver
}
@Test
public void test() throws Exception{
try{
cDriver.navigate().to(baseUrl);//Go!
//Thread.sleep(5000);//Everything below is just doing stuff on the page
cDriver.findElement(By.id("radioButtonssBasic")).click();
Select selector = new Select(cDriver.findElement(By.id("ap")));
selector.selectByValue("0SSIDisNAMED"+router);
cDriver.findElement(By.name("passphrase1")).sendKeys(routerPass);
cDriver.findElement(By.name("passphrase2")).sendKeys(routerPass);
cDriver.findElement(By.id("user")).sendKeys(user);
cDriver.findElement(By.name("password1")).sendKeys(userPass);
cDriver.findElement(By.name("password2")).sendKeys(userPass);
cDriver.findElement(By.id("submitButton")).click();
}finally{
Thread.sleep(2000);
cDriver.quit();
}