Firefox 44.0.1打开两个标签,运行selenium webdriver代码时 [英] Firefox 44.0.1 opening two tabs , when running selenium webdriver code

查看:150
本文介绍了Firefox 44.0.1打开两个标签,运行selenium webdriver代码时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Firefox最近得到了更新。我的Firefox版本是44.0.1。当我在selenium webdriver中运行一个简单的代码如下,两个选项卡在Firefox中打开。我怎样才能摆脱不需要的选项卡。我改变了Firefox设置,但仍然有两个标签正在打开。一个选项卡是普通选项卡,第二个选项卡是 https: //support.skype.com/en/faq/FA34612/what-is-the-skype-extension 。我如何加载我想要在一个Firefox窗口中自动化的URL。我需要改变任何Firefox设置。

  import org.openqa.selenium.WebDriver; 
导入org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
$ b $ public class Another {
@Test $ b $ public void tester(){
WebDriver driver = new FirefoxDriver();
driver.manage()。window()。maximize();
driver.get(http://jqueryui.com/datepicker/);




$ b

解决方案

创建一个Firefox配置文件并根据您的要求进行设置后将其保存为名称。请在脚本中调用此配置文件。



这里是创建firefox配置文件的步骤



以下是脚本例子

  ProfilesIni profile = new ProfilesIni(); 

FirefoxProfile myprofile = profile.getProfile(CreatedProfile);

WebDriver driver = new FirefoxDriver(myprofile);

谢谢,
Murali


My Firefox recently got updated recently. My firefox version is 44.0.1. When I run a simple code as below in selenium webdriver, two tabs are opening in firefox. How can i get rid of the unwanted tab. I changed Firefox setting, but still two tabs are opening. one tab is a plain tab and the second tab is https://support.skype.com/en/faq/FA34612/what-is-the-skype-extension. How can I load my URL that I want to automate in a single firefox window. Do I need to change any firefox setting.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;    
import org.testng.annotations.Test;

public class Another {
    @Test
    public void tester(){
        WebDriver driver = new FirefoxDriver();
    driver.manage().window().maximize();
    driver.get("http://jqueryui.com/datepicker/");


    }
}

解决方案

Create a Firefox Profile and save it with name after making settings as per your requirement. Please call this profile in script.

Here is the steps to create firefox profile

Below is the script for example

 ProfilesIni profile = new ProfilesIni();

 FirefoxProfile myprofile = profile.getProfile("CreatedProfile");

 WebDriver driver = new FirefoxDriver(myprofile);

Thank You, Murali

这篇关于Firefox 44.0.1打开两个标签,运行selenium webdriver代码时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆