Refine search
File profileDirectory = new File("c://mach//lib//prof"); FirefoxProfile profile = new FirefoxProfile(profileDirectory); DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(FirefoxDriver.PROFILE, profile); driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities);
FirefoxProfile p = new FirefoxProfile(); p.setPreference("javascript.enabled", false); driver = new FirefoxDriver(p);
FirefoxProfile firefoxProfile = new FirefoxProfile(); File extension = new File("extension.xpi"); firefoxProfile.addExtension(extension); DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile); driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities);
final String firebugPath = "C:\\FF_Profile\\firebug.xpi"; FirefoxProfile profile = new FirefoxProfile(); profile.addExtension(new File(firebugPath)); // Add more if needed WebDriver driver = new FirefoxDriver(profile);
FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("pdfjs.disabled", true); // disable the built-in viewer profile.setPreference("browser.download.folderList", 2); profile.setPreference("browser.download.dir", "C:\\Windows\\temp"); profile.setPreference("browser.download.panel.shown", false); profile.setPreference("browser.helperApps.neverAsk.openFile", ""); profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/vnd.ms-excel"); WebDriver driver = new FirefoxDriver(profile); driver.get("http://www.exinfm.com/free_spreadsheets.html"); driver.findElement(By.linkText("Capital Budgeting Analysis")).click();
FirefoxProfile profile = new FirefoxProfile(); profile.setEnableNativeEvents(true); profile.setPreference("app.update.auto", false); profile.setPreference("app.update.enabled", false); profile.setPreference("app.update.silent", false); driver = new FirefoxDriver(profile); driver.get("data:text/plain;charset=utf-8,XWiki"); driver.switchTo().activeElement().sendKeys(Keys.chord(Keys.CONTROL, "/")); } else if (browserName.startsWith("*iexplore")) { driver = new InternetExplorerDriver(); driver = new ChromeDriver(); } else if (browserName.startsWith("*phantomjs")) { DesiredCapabilities capabilities = DesiredCapabilities.phantomjs(); capabilities.setCapability("handlesAlerts", true); try { driver = new PhantomJSDriver(ResolvingPhantomJSDriverService.createDefaultService(), capabilities); driver.manage().window().maximize();
DesiredCapabilities dc=DesiredCapabilities.firefox(); FirefoxProfile profile = new FirefoxProfile(); dc.setCapability(FirefoxDriver.PROFILE, profile); WebDriver driver = new FirefoxDriver(dc); driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); driver.get("your-url"); // code upto your filter icon // webelement of your filter icon WebElement webelement = driver.findElement(By.className("k-icon k-filter")); webelement.click();
FirefoxProfile pro=new FirefoxProfile(); pro.setPreference("browser.downLoad.folderList", 0); pro.setPreference("browser.helperApps.neverAsk.saveToDisk", "Applications/zip"); WebDriver driver=new FirefoxDriver(pro); driver.get("http://selenium-release.storage.googleapis.com/2.47/selenium-java-2.47.1.zip");
WebDriver driver=null; Scanner scanner = new Scanner(System.in); // prompt for the URL System.out.print("Enter your URL: "); // get their input as a String String URL = scanner.next(); System.out.println( URL ); final FirefoxProfile firefoxProfile = new FirefoxProfile(); driver = new FirefoxDriver(firefoxProfile); driver.manage().window().maximize(); driver.get(URL);
@Override public WebCommunicationWrapper createWebDriver(ProxyServerWrapper proxyServer) throws WorkerException { try { Proxy proxy = proxyServer.seleniumProxy(); proxyServer.setCaptureContent(true); proxyServer.setCaptureHeaders(true); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.PROXY, proxy); capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); FirefoxProfile fp = getFirefoxProfile(); fp.setAcceptUntrustedCertificates(true); fp.setAssumeUntrustedCertificateIssuer(false); setCommonCapabilities(capabilities, fp); return new FirefoxCommunicationWrapperImpl(getFirefoxDriver(capabilities), proxyServer, requestExecutorFactory .createInstance()); } catch (Exception e) { throw new WorkerException(e.getMessage(), e); } }
public static WebDriver createFirefoxDriver(DesiredCapabilities capabilities) { if (capabilities != null) { return new FirefoxDriver(capabilities); } ProfilesIni allProfiles = new ProfilesIni(); FirefoxProfile myProfile = allProfiles.getProfile("WebDriver"); if (myProfile == null) { File ffDir = new File(System.getProperty("user.dir")+ File.separator+"ffProfile"); if (!ffDir.exists()) { ffDir.mkdir(); } myProfile = new FirefoxProfile(ffDir); } myProfile.setAcceptUntrustedCertificates(true); myProfile.setAssumeUntrustedCertificateIssuer(true); myProfile.setPreference("webdriver.load.strategy", "unstable"); if (capabilities == null) { capabilities = new DesiredCapabilities(); } capabilities.setCapability(FirefoxDriver.PROFILE, myProfile); return new FirefoxDriver(capabilities); }
private FirefoxProfile buildFirefoxProfile() { String profileName = ThucydidesSystemProperty.WEBDRIVER_FIREFOX_PROFILE.from(environmentVariables); FilePathParser parser = new FilePathParser(environmentVariables); DesiredCapabilities firefoxCapabilities = DesiredCapabilities.firefox(); if (StringUtils.isNotEmpty(profileName)) { firefoxCapabilities.setCapability(FirefoxDriver.PROFILE, parser.getInstanciatedPath(profileName)); } FirefoxProfile profile; if (profileName == null) { profile = createNewFirefoxProfile(); } else { profile = getProfileFrom(profileName); } firefoxProfileEnhancer.allowWindowResizeFor(profile); if (shouldActivateProxy()) { activateProxyFor(profile, firefoxProfileEnhancer); } if (refuseUntrustedCertificates()) { profile.setAssumeUntrustedCertificateIssuer(false); profile.setAcceptUntrustedCertificates(false); } else { profile.setAssumeUntrustedCertificateIssuer(true); profile.setAcceptUntrustedCertificates(true); } firefoxProfileEnhancer.configureJavaSupport(profile); firefoxProfileEnhancer.addPreferences(profile); return profile; }
FirefoxProfile profile = new FirefoxProfile(); FirefoxBinary firefoxBinary = new FirefoxBinary(); WebDriver driver = new FirefoxDriver(firefoxBinary, profile); driver.get("http://www.google.com"); Assert.assertEquals("Google", driver.getTitle().trim());
DesiredCapabilities capabilities = DesiredCapabilities.firefox(); FirefoxProfile fp = new FirefoxProfile(); fp.setAcceptUntrustedCertificates(true); fp.setAssumeUntrustedCertificateIssuer(true); fp.setEnableNativeEvents(false); fp.setPreference("browser.download.manager.showWhenStarting", false); fp.setPreference("browser.download.useDownloadDir", true); fp.setPreference("browser.download.dir", DEFAULT_DOWNLOAD_DIR); fp.setPreference("browser.download.lastDir", DEFAULT_DOWNLOAD_DIR); fp.setPreference("browser.download.folderList", 2); fp.setPreference("security.default_personal_cert", "Select Automatically"); fp.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream,application/x-compressed,application/x-zip-compressed,application/zip,multipart/x-zip"); fp.setPreference("network.websocket.enabled", false); fp.setPreference("signon.autologin.proxy", true); fp.setPreference("network.automatic-ntlm-auth.trusted-uris", "" + "paypal-attheregister.com," + "attheregister.com," + "moneypak.com," + "nextestate.com," + "necla"); fp.setPreference("network.automatic-ntlm-auth.allow-proxies", true); fp.setPreference("network. negotiate-auth. allow-proxies", true); fp.setPreference("browser.ssl_override_behavior", 1); fp.setPreference("security.fileuri.strict_origin_policy", false); fp.setPreference("security. default_personal_cert", "Select Automatically"); capabilities.setCapability(FirefoxDriver.PROFILE, fp);
File file = new File("firebug-1.8.1.xpi"); FirefoxProfile firefoxProfile = new FirefoxProfile(); firefoxProfile.addExtension(file); firefoxProfile.setPreference("extensions.firebug.currentVersion", "1.8.1"); // Avoid startup screen WebDriver driver = new FirefoxDriver(firefoxProfile);
DesiredCapabilities cap = new DesiredCapabilities(); File firefoxProfileFolder = new File("/path/to/your/firefox/profile/profileFF"); FirefoxProfile myprofile = new FirefoxProfile(firefoxProfileFolder); cap.setCapability(FirefoxDriver.PROFILE, myprofile );
File downloadDir = new File(DOWNLOAD_PATH); FirefoxProfile fProfile = new FirefoxProfile(); fProfile.setAcceptUntrustedCertificates(true); fProfile.setPreference("browser.download.dir", downloadDir.getAbsolutePath()); fProfile.setPreference("browser.download.folderList", 2); fProfile.setPreference("browser.download.manager.showWhenStarting", false); fProfile.setPreference("browser.helperApps.alwaysAsk.force", false); fProfile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/plain"); DesiredCapabilities dc = DesiredCapabilities.firefox(); dc.setJavascriptEnabled(true); dc.setCapability(FirefoxDriver.PROFILE, fProfile); driver = new FirefoxDriver(dc);
@Override public WebDriver createDriver() { FirefoxProfile profile = new FirefoxProfile(); String dir = "target/downloads"; profile.setPreference("browser.download.defaultFolder", dir); profile.setPreference("browser.download.downloadDir", dir); profile.setPreference("browser.download.lastDir", dir); profile.setPreference("browser.download.dir", dir); profile.setPreference("browser.download.useDownloadDir", "true"); profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/json"); profile.setPreference("browser.download.folderList", 2); profile.setPreference("browser.download manager.useWindow", "false"); DesiredCapabilities dc = DesiredCapabilities.firefox(); dc.setCapability(FirefoxDriver.PROFILE, profile); return new FirefoxDriver(dc); }
//It creates firefox profile FirefoxProfile profile=new FirefoxProfile(); // This will set the true value profile.setAcceptUntrustedCertificates(true); // This will open firefox browser using above created profile WebDriver driver=new FirefoxDriver(); driver.get("pass the url as per your requirement");
FirefoxProfile oProfile = new FirefoxProfile(); File extension = new File("scrapbook-1.5.11-fx.xpi"); try { oProfile.addExtension(extension); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } WebDriver driver = new FirefoxDriver(oProfile); driver.get("https://google.com"); new Actions(driver).sendKeys(Keys.chord(Keys.CONTROL,Keys.SHIFT, "D")).perform();