我的问题看上去可能有些奇怪,也可能有些软弱,但请您告诉我,用任何配置文件加载firefox的真正用途是什么?
你能告诉我们,如果还有其他地方(实时场景),我们可能需要火狐配置文件吗?
发布于 2015-12-15 07:56:32
如果我们没有定义任何配置文件,那么Selenium将使用默认的新鲜firefox配置文件。
但在某些情况下,我们对浏览器有特定的要求。例如..。
以上都是个人配置文件设置,可以在我们的selenium项目中的自定义配置文件中定义。
有关更多详细信息,请查看:http://toolsqa.com/selenium-webdriver/custom-firefox-profile/
在此期间,我建议您加入https://sqa.stackexchange.com/,这是一个专门针对SQA相关问题的论坛。你在那里得到答案的机会会更大。
发布于 2016-05-02 20:52:03
分析帮助更新火狐内部的首选项。我们可以通过实例化Firefox配置文件对象,然后更新设置来做到这一点。然后,我们需要将这个对象传递到Firefox驱动程序中,后者将使用您定义的设置加载配置文件。
例如:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.annotations.Test;
public class FireFoxProfileExample {
WebDriver driver;
@Test
public void testExamples(){
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.startup.homepage",
"http://www.google.com");
driver = new FirefoxDriver(profile);
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("100");
}希望这能帮你!
https://stackoverflow.com/questions/34273103
复制相似问题