2015-12-14 25 views
0

我的問題可能看起來很奇怪或很弱,但你能告訴我什麼是用任何配置文件加載Firefox的真正用法嗎?用什麼加載Firefox的配置文件

  1. 加載Firefox的插件(有人可以解釋一些真實的場景)。我從來沒有遇到過這種情況。
  2. 我想解決SSL證書問題。 (現在沒有銀行或金融網站不顯示這些證書警告)。我們在哪裏使用此配置文件的Firefox?

請問我們是否有任何其他地方(實時情況)我們可能需要使用firefox配置文件?

回答

1

如果我們不定義任何配置文件,那麼Selenium Webdriver會使用默認的新鮮firefox配置文件。

但是在某些情況下,我們對瀏覽器有特定的要求。例如..

  • 我們可以期望它有歷史記錄
  • 我們可能希望它記住密碼
  • ,我們可能需要在我們的測試中的webdriver
  • 等利用一些Firefox的插件..

以上所有都屬於個人配置文件設置,可以在我們的硒項目的自定義配置文件中定義。

有關詳情,請:http://toolsqa.com/selenium-webdriver/custom-firefox-profile/

之間,我會建議你加入https://sqa.stackexchange.com/專門爲SQA相關的問題的論壇。你將有更大的機會在那裏獲得答案。

0

分析可幫助我們在Firefox中更新首選項。 我們可以通過實例化一個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"); 

} 

希望這可以幫助你!

相關問題