首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OperaDriver没有导航到所需的URL

OperaDriver没有导航到所需的URL
EN

Stack Exchange QA用户
提问于 2012-10-11 06:30:07
回答 1查看 1.4K关注 0票数 5

我尝试使用OperaDriver打开一个URL。我的问题是,我正在启动浏览器,但所需的页面没有加载。下面是密码。

代码语言:javascript
复制
@BeforeClass
public static void setUpBeforeClass() throws Exception {


/*  DesiredCapabilities capabilities = DesiredCapabilities.opera();
      capabilities.setCapability("opera.binary","C:/Program Files(x86)/Opera/opera.exe");
      driver = new OperaDriver(capabilities); 
      */

      DesiredCapabilities capabilities = new DesiredCapabilities();
      capabilities.setCapability("opera.binary","Opera/opera.exe");
      //capabilities.setCapability("opera.log.level", "CONFIG");
      capabilities.setCapability("opera.port", "-1");
      capabilities.setCapability("opera.profile", "");
       driver = new OperaDriver(capabilities);



}

@Test
public void testCreateAccount() throws Exception{

driver.navigate().to("http://google.com/");



}

我正在使用11.10版本,并以JUnit的形式运行测试。

当它失败时,将在控制台中返回以下内容。

sun.nio.ch.SelectorImpl.selectedKeys(SelectorImpl.java:75) at com.opera.core.systems.util.SocketMonitor.pollSockets(SocketMonitor.java:132) at com.opera.core.systems.util.SocketMonitor.poll(SocketMonitor.java:108) at com.opera.core.systems.scope.stp.StpThread.run(StpThread.java:60)中的线程“stp-线程”java.nio.channels.ClosedSelectorException中的异常

提前感谢

EN

回答 1

Stack Exchange QA用户

发布于 2013-03-26 13:05:27

试试这种方法对我来说很好……

代码语言:javascript
复制
capabilities = new DesiredCapabilities();   capabilities.setBrowserName("opera");               capabilities.setCapability("opera.autostart ",true);

driver = new RemoteWebDriver(server, capabilities);
driver.get("http://google.com/");
票数 2
EN
页面原文内容由Stack Exchange QA提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://sqa.stackexchange.com/questions/3976

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档