How to use prepareFireFoxProfile method of com.paypal.selion.internal.platform.grid.browsercapabilities.FireFoxCapabilitiesBuilder class

Best SeLion code snippet using com.paypal.selion.internal.platform.grid.browsercapabilities.FireFoxCapabilitiesBuilder.prepareFireFoxProfile

Source:FireFoxCapabilitiesBuilder.java Github

copy

Full Screen

...31class FireFoxCapabilitiesBuilder extends DefaultCapabilitiesBuilder {32 @Override33 public DesiredCapabilities getCapabilities(DesiredCapabilities capabilities) {34 capabilities.setBrowserName(DesiredCapabilities.firefox().getBrowserName());35 capabilities.setCapability(FirefoxDriver.PROFILE, prepareFireFoxProfile());36 if (ProxyHelper.isProxyServerRequired()) {37 capabilities.setCapability(CapabilityType.PROXY, ProxyHelper.createProxyObject());38 }39 if (!isLegacyFF()) {40 capabilities.setCapability(FirefoxDriver.MARIONETTE, true);41 String geckoDriverPath = getBinaryPath();42 if (isLocalRun() && StringUtils.isNotBlank(geckoDriverPath)) {43 System.setProperty(SeLionConstants.WEBDRIVER_GECKO_DRIVER_PROPERTY, geckoDriverPath);44 }45 }46 return capabilities;47 }48 private FirefoxProfile getProfile(String dirName) {49 logger.entering(dirName);50 FirefoxProfile profile = null;51 File profileDir = new File(dirName);52 if (profileDir.exists()) {53 // If the user provided us with a dir name that represents a FF profile return a profile using that54 logger.finer(String.format("Working with the firefox profile directory [%s]", profileDir.getAbsolutePath()));55 profile = new FirefoxProfile(profileDir);56 }57 logger.exiting(profile);58 return profile;59 }60 private FirefoxProfile getProfile() {61 logger.entering();62 String profileName = getLocalConfigProperty(ConfigProperty.SELENIUM_FIREFOX_PROFILE);63 // Create a new anonymous profile if the user didn't provide any profiles to be used64 if (StringUtils.isBlank(profileName)) {65 logger.finer("Working with an anonymous firefox profile");66 FirefoxProfile profile = new FirefoxProfile();67 logger.exiting(profile);68 return profile;69 }70 FirefoxProfile profile = new ProfilesIni().getProfile(profileName);71 if (profile != null) {72 // If the user gave a valid profile name, create a profile using the name and return it back73 logger.finer(String.format("Working with the firefox profile [%s]", profileName));74 logger.exiting(profile);75 return profile;76 }77 profile = getProfile(profileName);78 if (profile == null) {79 // User provided us with an invalid value. Inform the user and create an anonymous profile.80 String infoMsg = String.format(81 "[%s] is NOT a valid profile name/directory. Proceeding with using an anonymous profile.",82 profileName);83 logger.finer(infoMsg);84 profile = new FirefoxProfile();85 }86 logger.exiting(profile);87 return profile;88 }89 private FirefoxProfile prepareFireFoxProfile() {90 logger.entering();91 FirefoxProfile profile = getProfile();92 String userAgent = getUserAgent();93 if (StringUtils.isNotBlank(userAgent)) {94 profile.setPreference("general.useragent.override", userAgent);95 }96 // To understand why the below preferences are being set please97 // see http://code.google.com/p/selenium/issues/detail?id=286398 profile.setPreference("capability.policy.default.HTMLDocument.readyState", "allAccess");99 profile.setPreference("capability.policy.default.HTMLDocument.compatMode", "allAccess");100 profile.setPreference("capability.policy.default.Document.compatMode", "allAccess");101 profile.setPreference("capability.policy.default.Location.href", "allAccess");102 profile.setPreference("capability.policy.default.Window.pageXOffset", "allAccess");103 profile.setPreference("capability.policy.default.Window.pageYOffset", "allAccess");...

Full Screen

Full Screen

prepareFireFoxProfile

Using AI Code Generation

copy

Full Screen

1import com.paypal.selion.platform.grid.browsercapabilities.FireFoxCapabilitiesBuilder;2DesiredCapabilities capabilities = new FireFoxCapabilitiesBuilder().prepareFireFoxProfile().getCapabilities();3import com.paypal.selion.platform.grid.browsercapabilities.ChromeCapabilitiesBuilder;4DesiredCapabilities capabilities = new ChromeCapabilitiesBuilder().prepareChromeOptions().getCapabilities();5import com.paypal.selion.platform.grid.browsercapabilities.InternetExplorerCapabilitiesBuilder;6DesiredCapabilities capabilities = new InternetExplorerCapabilitiesBuilder().prepareInternetExplorerOptions().getCapabilities();7import com.paypal.selion.platform.grid.browsercapabilities.SafariCapabilitiesBuilder;8DesiredCapabilities capabilities = new SafariCapabilitiesBuilder().prepareSafariOptions().getCapabilities();9import com.paypal.selion.platform.grid.browsercapabilities.OperaCapabilitiesBuilder;10DesiredCapabilities capabilities = new OperaCapabilitiesBuilder().prepareOperaOptions().getCapabilities();11import com.paypal.selion.platform.grid.browsercapabilities.IosCapabilitiesBuilder;12DesiredCapabilities capabilities = new IosCapabilitiesBuilder().prepareIosCapabilities().getCapabilities();13import com.paypal.selion.platform.grid.browsercapabilities.AndroidCapabilitiesBuilder;14DesiredCapabilities capabilities = new AndroidCapabilitiesBuilder().prepareAndroidCapabilities().getCapabilities();15import com.paypal.selion.platform.grid.browsercapabilities.HtmlUnitCapabilitiesBuilder;16DesiredCapabilities capabilities = new HtmlUnitCapabilitiesBuilder().prepareHtmlUnitCapabilities().getCapabilities();17import com.paypal.selion.platform.grid.browsercapabilities.HtmlUnitCapabilitiesBuilder;18DesiredCapabilities capabilities = new HtmlUnitCapabilitiesBuilder().prepareHtml

Full Screen

Full Screen

prepareFireFoxProfile

Using AI Code Generation

copy

Full Screen

1import com.paypal.selion.platform.grid.browsercapabilities.FireFoxCapabilitiesBuilder;2import com.paypal.selion.platform.grid.browsercapabilities.FireFoxProfile;3import org.openqa.selenium.firefox.FirefoxProfile;4public class TestSelion {5 public static void main(String[] args) {6 FirefoxProfile profile = FireFoxCapabilitiesBuilder.prepareFireFoxProfile(new FireFoxProfile());7 }8}9import com.paypal.selion.platform.grid.browsercapabilities.FireFoxCapabilitiesBuilder;10import com.paypal.selion.platform.grid.browsercapabilities.FireFoxProfile;11import org.openqa.selenium.firefox.FirefoxProfile;12public class TestSelion {13 public static void main(String[] args) {14 FirefoxProfile profile = FireFoxCapabilitiesBuilder.prepareFireFoxProfile(new FireFoxProfile());15 }16}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeLion automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in FireFoxCapabilitiesBuilder

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful