2016-05-04 7 views
6

से माइग्रेट करना मैं फ़ायरफ़ॉक्स ड्रायवर से मैरियनेट ड्रायवर में स्विच करने की कोशिश कर रहा हूं।फ़ायरफ़ॉक्स वेबड्राइवर से मैरियनेट

public void runMarionnete(){ 
    DesiredCapabilities dc = DesiredCapabilities.firefox(); 
    OSUtils.setProperty("webdriver.firefox.bin", "C:\\Firefox\\firefox.exe"); 
    OSUtils.setProperty("webdriver.gecko.driver","C:\\Drivers\\wires-0.6.2-win.exe")); 
    _driver = new MarionetteDriver(dc); 
} 

लेकिन मेरे पास है 2 बातें मैं कैसे करना है यकीन नहीं है:

1.How चालक को XPI एक्सटेंशन जोड़ने के लिए मैं MarionetteDriver साथ फ़ायरफ़ॉक्स चलाने के लिए चल रहा है द्वारा प्रबंधित? पुराने तरीके से मैं प्रयोग किया जाता में : FirefoxProfile.addExtension ...

2.How सभी फ़ायरफ़ॉक्स प्रॉपर्टी कॉन्फ़िगर करने, जैसे मैं उदाहरण के लिए, ऐसा करने के लिए प्रयोग किया है:

profile.setPreference("browser.startup.homepage;about:home","about:blank"); 
    profile.setPreference("startup.homepage_welcome_url","about:blank"); 
    profile.setPreference("browser.usedOnWindows10.introURL","about:blank"); 
    profile.setPreference("devtools.devedition.promo.url",""); 
    profile.setPreference("xpinstall.signatures.required",false); 

धन्यवाद!

उत्तर

3

आप एक ही FirefoxProfile वर्ग का उपयोग कर सकते सिर्फ निम्नलिखित तरीके से DesiredCapabilities में जोड़ें:

FirefoxProfile firefoxProfile = new FirefoxProfile(); 
firefoxProfile.setPreference("browser.startup.homepage;about:home","about:blank"); 
firefoxProfile.setPreference("startup.homepage_welcome_url","about:blank"); 
firefoxProfile.setPreference("browser.usedOnWindows10.introURL","about:blank"); 
firefoxProfile.setPreference("devtools.devedition.promo.url",""); 
firefoxProfile.setPreference("xpinstall.signatures.required",false); 

DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox(); 
desiredCapabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile); 
+3

मुझे आश्चर्य है अगर वहाँ इस के लिए किसी भी अधिक। मैंने क्षमताओं को जोड़ने का प्रयास किया, लेकिन डाउनलोड निर्देशिका और ऑटो डाउनलोड को सेट करने के लिए अभी भी मेरे लिए काम नहीं किया। – JPhi1618

+0

मुझे ऑटो डाउनलोड के साथ भी परेशानी है - क्या इसका कोई अपडेट रहा है? 'fp = webdriver.FirefoxProfile()' ' fp.set_preference (" browser.download.folderList ", 2) fp.set_preference (" browser.download.manager.showWhenStarting ", झूठी): यहाँ मेरी कोड है fp.set_preference ("browser.download.dir", "एच: \ डाउनलोड") fp.set_preference ("browser.download.downloadDir", "एच: \ डाउनलोड") fp.set_preference ("browser.download। defaultFolder "," एच: \ डाउनलोड ")' 'ड्राइवर = webdriver.Firefox (क्षमताओं = firefox_capabilities, firefox_binary = द्विआधारी, firefox_profile = एफपी)' मैं कुछ याद आ रही है? –

+0

मैं इस धागे में आया: [लिंक] (https://github.com/mozilla/geckodriver/issues/236) जो अंततः इस धागे के साथ समाप्त होता है: [link] (https://github.com/SeleniumHQ/selenium/ मुद्दों/2572)। बाद वाला धागा इस मामले पर सबसे हालिया चर्चा प्रतीत होता है। मैंने पूछा कि मेरे कोड को कैसे अपडेट किया जाए, और जब इसे पता लगाया जाए तो इस धागे को अपडेट कर देगा। –

संबंधित मुद्दे