How to use setPlatform method of org.openqa.selenium.remote.DesiredCapabilities class

Best Selenium code snippet using org.openqa.selenium.remote.DesiredCapabilities.setPlatform

Source:Appium.java Github

copy

Full Screen

...22 caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");23 caps.setCapability(MobileCapabilityType.UDID,"ZY3228SRS5");24 DesiredCapabilities.chrome();25 caps.setBrowserName("chrome"); 26 caps.setPlatform(Platform.WINDOWS);27 caps.setCapability(MobileCapabilityType.BROWSER_NAME,"Chrome");28 29 caps.setCapability(MobileCapabilityType.BROWSER_VERSION,"66.0.3359.158");30 caps.setCapability(MobileCapabilityType.NO_RESET, "false");31 caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.chrome"); 32 caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.google.android.apps.chrome.Main");33 34 driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),caps);35 driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); 36 37 driver.get("http://13.228.56.78/flex/html5/");38 }39 catch(Exception e)40 {41 e.printStackTrace();42 }43 44 45 }46}47///////////////////////Common///////////////////48package com.appium; 49// import java.net.MalformedURLException;50import java.net.URL;51import java.util.concurrent.TimeUnit;52import org.openqa.selenium.Platform;53import org.openqa.selenium.remote.DesiredCapabilities;54import org.openqa.selenium.remote.RemoteWebDriver;55import org.testng.annotations.Test;56import io.appium.java_client.remote.AndroidMobileCapabilityType;57import io.appium.java_client.remote.MobileCapabilityType;58public class Appium {59 60public RemoteWebDriver driver;61 @Test62 public void run() {63 64 try65 {66 DesiredCapabilities caps = new DesiredCapabilities();67 caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Abilash");68 caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");69 caps.setCapability(MobileCapabilityType.UDID,"ZY3228SRS5");70 DesiredCapabilities.chrome();71 caps.setBrowserName("chrome"); 72 caps.setPlatform(Platform.WINDOWS);73 caps.setCapability(MobileCapabilityType.BROWSER_NAME,"Chrome");74 75 caps.setCapability(MobileCapabilityType.BROWSER_VERSION,"66.0.3359.158");76 caps.setCapability(MobileCapabilityType.NO_RESET, "false");77 caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.chrome"); 78 caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.google.android.apps.chrome.Main");79 80 driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),caps);81 driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); 82 83 driver.get("http://13.228.56.78/flex/html5/");84 }85 catch(Exception e)86 {87 e.printStackTrace();88 }89 90 91 }92}93///////////////////////Common///////////////////94package com.appium; 95// import java.net.MalformedURLException;96import java.net.URL;97import java.util.concurrent.TimeUnit;98import org.openqa.selenium.Platform;99import org.openqa.selenium.remote.DesiredCapabilities;100import org.openqa.selenium.remote.RemoteWebDriver;101import org.testng.annotations.Test;102import io.appium.java_client.remote.AndroidMobileCapabilityType;103import io.appium.java_client.remote.MobileCapabilityType;104public class Appium {105 106public RemoteWebDriver driver;107 @Test108 public void run() {109 110 try111 {112 DesiredCapabilities caps = new DesiredCapabilities();113 caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Abilash");114 caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");115 caps.setCapability(MobileCapabilityType.UDID,"ZY3228SRS5");116 DesiredCapabilities.chrome();117 caps.setBrowserName("chrome"); 118 caps.setPlatform(Platform.WINDOWS);119 caps.setCapability(MobileCapabilityType.BROWSER_NAME,"Chrome");120 121 caps.setCapability(MobileCapabilityType.BROWSER_VERSION,"66.0.3359.158");122 caps.setCapability(MobileCapabilityType.NO_RESET, "false");123 caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.chrome"); 124 caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.google.android.apps.chrome.Main");125 126 driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),caps);127 driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); 128 129 driver.get("http://13.228.56.78/flex/html5/");130 }131 catch(Exception e)132 {133 e.printStackTrace();134 }135 136 137 }138}139///////////////////////Common///////////////////140package com.appium; 141// import java.net.MalformedURLException;142import java.net.URL;143import java.util.concurrent.TimeUnit;144import org.openqa.selenium.Platform;145import org.openqa.selenium.remote.DesiredCapabilities;146import org.openqa.selenium.remote.RemoteWebDriver;147import org.testng.annotations.Test;148import io.appium.java_client.remote.AndroidMobileCapabilityType;149import io.appium.java_client.remote.MobileCapabilityType;150public class Appium {151 152public RemoteWebDriver driver;153 @Test154 public void run() {155 156 try157 {158 DesiredCapabilities caps = new DesiredCapabilities();159 caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Abilash");160 caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");161 caps.setCapability(MobileCapabilityType.UDID,"ZY3228SRS5");162 DesiredCapabilities.chrome();163 caps.setBrowserName("chrome"); 164 caps.setPlatform(Platform.WINDOWS);165 caps.setCapability(MobileCapabilityType.BROWSER_NAME,"Chrome");166 167 caps.setCapability(MobileCapabilityType.BROWSER_VERSION,"66.0.3359.158");168 caps.setCapability(MobileCapabilityType.NO_RESET, "false");169 caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.chrome"); 170 caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.google.android.apps.chrome.Main");171 172 driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),caps);173 driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); 174 175 driver.get("http://13.228.56.78/flex/html5/");176 }177 catch(Exception e)178 {179 e.printStackTrace();180 }181 182 183 }184}185///////////////////////Common///////////////////186package com.appium; 187// import java.net.MalformedURLException;188import java.net.URL;189import java.util.concurrent.TimeUnit;190import org.openqa.selenium.Platform;191import org.openqa.selenium.remote.DesiredCapabilities;192import org.openqa.selenium.remote.RemoteWebDriver;193import org.testng.annotations.Test;194import io.appium.java_client.remote.AndroidMobileCapabilityType;195import io.appium.java_client.remote.MobileCapabilityType;196public class Appium {197 198public RemoteWebDriver driver;199 @Test200 public void run() {201 202 try203 {204 DesiredCapabilities caps = new DesiredCapabilities();205 caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Abilash");206 caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");207 caps.setCapability(MobileCapabilityType.UDID,"ZY3228SRS5");208 DesiredCapabilities.chrome();209 caps.setBrowserName("chrome"); 210 caps.setPlatform(Platform.WINDOWS);211 caps.setCapability(MobileCapabilityType.BROWSER_NAME,"Chrome");212 213 caps.setCapability(MobileCapabilityType.BROWSER_VERSION,"66.0.3359.158");214 caps.setCapability(MobileCapabilityType.NO_RESET, "false");215 caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.chrome"); 216 caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.google.android.apps.chrome.Main");217 218 driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),caps);219 driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); 220 221 driver.get("http://13.228.56.78/flex/html5/");222 }223 catch(Exception e)224 {...

Full Screen

Full Screen

Source:Appium01.java Github

copy

Full Screen

...22 caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");23 caps.setCapability(MobileCapabilityType.UDID,"ZY3228SRS5");24 DesiredCapabilities.chrome();25 caps.setBrowserName("chrome"); 26 caps.setPlatform(Platform.WINDOWS);27 caps.setCapability(MobileCapabilityType.BROWSER_NAME,"Chrome");28 29 caps.setCapability(MobileCapabilityType.BROWSER_VERSION,"66.0.3359.158");30 caps.setCapability(MobileCapabilityType.NO_RESET, "false");31 caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.chrome"); 32 caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.google.android.apps.chrome.Main");33 34 driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),caps);35 driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); 36 37 driver.get("http://13.228.56.78/flex/html5/");38 }39 catch(Exception e)40 {41 e.printStackTrace();42 }43 44 45 }46}47///////////////////////Common///////////////////48package com.appium; 49// import java.net.MalformedURLException;50import java.net.URL;51import java.util.concurrent.TimeUnit;52import org.openqa.selenium.Platform;53import org.openqa.selenium.remote.DesiredCapabilities;54import org.openqa.selenium.remote.RemoteWebDriver;55import org.testng.annotations.Test;56import io.appium.java_client.remote.AndroidMobileCapabilityType;57import io.appium.java_client.remote.MobileCapabilityType;58public class Appium {59 60public RemoteWebDriver driver;61 @Test62 public void run() {63 64 try65 {66 DesiredCapabilities caps = new DesiredCapabilities();67 caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Abilash");68 caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");69 caps.setCapability(MobileCapabilityType.UDID,"ZY3228SRS5");70 DesiredCapabilities.chrome();71 caps.setBrowserName("chrome"); 72 caps.setPlatform(Platform.WINDOWS);73 caps.setCapability(MobileCapabilityType.BROWSER_NAME,"Chrome");74 75 caps.setCapability(MobileCapabilityType.BROWSER_VERSION,"66.0.3359.158");76 caps.setCapability(MobileCapabilityType.NO_RESET, "false");77 caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.chrome"); 78 caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.google.android.apps.chrome.Main");79 80 driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),caps);81 driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); 82 83 driver.get("http://13.228.56.78/flex/html5/");84 }85 catch(Exception e)86 {87 e.printStackTrace();88 }89 90 91 }92}93///////////////////////Common///////////////////94package com.appium; 95// import java.net.MalformedURLException;96import java.net.URL;97import java.util.concurrent.TimeUnit;98import org.openqa.selenium.Platform;99import org.openqa.selenium.remote.DesiredCapabilities;100import org.openqa.selenium.remote.RemoteWebDriver;101import org.testng.annotations.Test;102import io.appium.java_client.remote.AndroidMobileCapabilityType;103import io.appium.java_client.remote.MobileCapabilityType;104public class Appium {105 106public RemoteWebDriver driver;107 @Test108 public void run() {109 110 try111 {112 DesiredCapabilities caps = new DesiredCapabilities();113 caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Abilash");114 caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");115 caps.setCapability(MobileCapabilityType.UDID,"ZY3228SRS5");116 DesiredCapabilities.chrome();117 caps.setBrowserName("chrome"); 118 caps.setPlatform(Platform.WINDOWS);119 caps.setCapability(MobileCapabilityType.BROWSER_NAME,"Chrome");120 121 caps.setCapability(MobileCapabilityType.BROWSER_VERSION,"66.0.3359.158");122 caps.setCapability(MobileCapabilityType.NO_RESET, "false");123 caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.chrome"); 124 caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.google.android.apps.chrome.Main");125 126 driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),caps);127 driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); 128 129 driver.get("http://13.228.56.78/flex/html5/");130 }131 catch(Exception e)132 {133 e.printStackTrace();134 }135 136 137 }138}139///////////////////////Common///////////////////140package com.appium; 141// import java.net.MalformedURLException;142import java.net.URL;143import java.util.concurrent.TimeUnit;144import org.openqa.selenium.Platform;145import org.openqa.selenium.remote.DesiredCapabilities;146import org.openqa.selenium.remote.RemoteWebDriver;147import org.testng.annotations.Test;148import io.appium.java_client.remote.AndroidMobileCapabilityType;149import io.appium.java_client.remote.MobileCapabilityType;150public class Appium {151 152public RemoteWebDriver driver;153 @Test154 public void run() {155 156 try157 {158 DesiredCapabilities caps = new DesiredCapabilities();159 caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Abilash");160 caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");161 caps.setCapability(MobileCapabilityType.UDID,"ZY3228SRS5");162 DesiredCapabilities.chrome();163 caps.setBrowserName("chrome"); 164 caps.setPlatform(Platform.WINDOWS);165 caps.setCapability(MobileCapabilityType.BROWSER_NAME,"Chrome");166 167 caps.setCapability(MobileCapabilityType.BROWSER_VERSION,"66.0.3359.158");168 caps.setCapability(MobileCapabilityType.NO_RESET, "false");169 caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.android.chrome"); 170 caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.google.android.apps.chrome.Main");171 172 driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"),caps);173 driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS); 174 175 driver.get("http://13.228.56.78/flex/html5/");176 }177 catch(Exception e)178 {...

Full Screen

Full Screen

Source:DriverType.java Github

copy

Full Screen

...19 public DesiredCapabilities getDesiredCapabilities(Proxy proxySettings) {20 String platform = System.getProperty("os.name");21 DesiredCapabilities capabilities = DesiredCapabilities.firefox();22 if (platform.toLowerCase().startsWith("mac")) {23 capabilities.setPlatform(Platform.MAC);24 System.setProperty("webdriver.chrome.driver", "./drivers/geckodriver");25 } else if ("linux".equalsIgnoreCase(platform)) {26 capabilities.setPlatform(Platform.LINUX);27 System.setProperty("webdriver.chrome.driver", "./drivers/geckodriver_linux");28 } else if ("unix".equalsIgnoreCase(platform)) {29 capabilities.setPlatform(Platform.UNIX);30 System.setProperty("webdriver.chrome.driver", "./drivers/geckodriver");31 } else {32 capabilities.setPlatform(Platform.ANY);33 System.setProperty("webdriver.chrome.driver", "C:/selenium-drivers/geckodriver.exe");34 }35 return addProxySettings(capabilities, proxySettings);36 }37 public WebDriver getWebDriverObject(DesiredCapabilities capabilities) {38 return new FirefoxDriver(capabilities);39 }40 },41 CHROME {42 public DesiredCapabilities getDesiredCapabilities(Proxy proxySettings) {43 String platform = System.getProperty("os.name");44 DesiredCapabilities capabilities = DesiredCapabilities.chrome();45 capabilities.setCapability("chrome.switches", Arrays.asList("--no-default-browser-check"));46 HashMap<String, String> chromePreferences = new HashMap<String, String>();47 chromePreferences.put("profile.password_manager_enabled", "false");48 capabilities.setCapability("chrome.prefs", chromePreferences);49 if (platform.toLowerCase().startsWith("mac")) {50 capabilities.setPlatform(Platform.MAC);51 System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver");52 } else if ("linux".equalsIgnoreCase(platform)) {53 capabilities.setPlatform(Platform.LINUX);54 System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver_linux");55 } else if ("unix".equalsIgnoreCase(platform)) {56 capabilities.setPlatform(Platform.UNIX);57 System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver");58 } else {59 capabilities.setPlatform(Platform.ANY);60 System.setProperty("webdriver.chrome.driver", "C:/selenium-drivers/chromedriver.exe");61 }62 return addProxySettings(capabilities, proxySettings);63 }64 public WebDriver getWebDriverObject(DesiredCapabilities capabilities) {65 return new ChromeDriver(capabilities);66 }67 },68 IE {69 public DesiredCapabilities getDesiredCapabilities(Proxy proxySettings) {70 DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();71 capabilities.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);72 capabilities.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, true);73 capabilities.setCapability("requireWindowFocus", true);...

Full Screen

Full Screen

Source:DriverFactory.java Github

copy

Full Screen

...26 options.addArguments("--start-maximized");27 if (runmode.equalsIgnoreCase("remote")) {28 DesiredCapabilities cap = new DesiredCapabilities();29 cap.setBrowserName(BrowserType.CHROME);30 //cap.setPlatform(Platform.MAC); // it will run on MAC platform31 // cap.setPlatform(Platform.LINUX); // it will run on LINUX platfrom32 driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);33 } else {34 WebDriverManager.chromedriver().setup();35 driver = new ChromeDriver(options);36 // WebDriverManager.chromedriver().clearResolutionCache().setup()37 }38 } else if (browser.equalsIgnoreCase("firefox")) {39 FirefoxOptions options = new FirefoxOptions();40 options.addArguments("-private");41 if (runmode.equalsIgnoreCase("remote")) {42 DesiredCapabilities cap = new DesiredCapabilities();43 cap.setBrowserName(BrowserType.FIREFOX);44 // cap.setPlatform(Platform.valueOf("MAC")); // it will run on MAC platform45 // cap.setPlatform(Platform.LINUX); // it will run on LINUX platfrom46 driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);47 } else {48 WebDriverManager.firefoxdriver().setup();49 driver = new FirefoxDriver(options);50 // WebDriverManager.chromedriver().clearResolutionCache().setup()51 }52 } else if (browser.equalsIgnoreCase("ie")) {53 InternetExplorerOptions ieOptions = new InternetExplorerOptions();54 ieOptions.setCapability(InternetExplorerDriver.IE_SWITCHES, "-private");55 if (runmode.equalsIgnoreCase("remote")) {56 DesiredCapabilities cap = new DesiredCapabilities();57 cap.setBrowserName(BrowserType.IE);58 driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);59 } else {...

Full Screen

Full Screen

Source:SeleniumGridTests.java Github

copy

Full Screen

...30 //String browserType = "internet explorer";31 if (browserType.equals("firefox")) {32 dr = DesiredCapabilities.firefox();33 dr.setBrowserName("firefox");34 dr.setPlatform(Platform.WINDOWS);35 36 } 37 else if (browserType.equals("chrome"))38 {39 dr = DesiredCapabilities.chrome();40 dr.setBrowserName("chrome");41 dr.setPlatform(Platform.WINDOWS);42 }43 else 44 {45 dr = DesiredCapabilities.internetExplorer();46 dr.setBrowserName("internet explorer");47 dr.setPlatform(Platform.WINDOWS);48 }49 50 RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dr);51 System.out.println("Browser opened: " + browserType);52 driver.navigate().to("http://www.facebook.com/");53 driver.manage().window().maximize();54 System.out.println("Page title is: " + driver.getTitle());55 driver.findElement(By.id("email")).sendKeys("irfan@trainingrite.com");56 driver.findElement(By.cssSelector("#pass")).sendKeys("Passw0rd!@#");57 // Thread.sleep(3000);58 driver.findElement(By.id("u_0_8")).click();59 driver.quit();60 }61 public void setUp() throws MalformedURLException {62 // System.setProperty("webdriver.chrome.driver", "chromedriver.exe");63 // WebDriver driver = new ChromeDriver();64 baseURL = "http://amazon.com/";65 nodeURL = "http://127.0.0.1:4444//wd/hub";66 DesiredCapabilities capability = DesiredCapabilities.chrome();67 capability.setBrowserName("chrome");68 // DesiredCapabilities cap = DesiredCapabilities.firefox();69 // cap.setPlatform(Platform.WIN10);70 // driver = new RemoteWebDriver(new URL(nodeURL), cap);71 driver = new RemoteWebDriver(new URL(nodeURL), capability);72 /*73 * baseURL = "http://amazon.com/"; DesiredCapabilities caps =74 * DesiredCapabilities.chrome(); ChromeOptions options = new ChromeOptions();75 * options.addArguments("disable-infobars");76 * caps.setCapability(ChromeOptions.CAPABILITY, options); driver = new77 * RemoteWebDriver(new URL("http://127.0.0.1:4444/wd/hub"), caps);78 */79 }80 81 public void afterTest() {82 //driver.quit();83 }...

Full Screen

Full Screen

Source:TestBase.java Github

copy

Full Screen

...23 throws MalformedURLException, Exception {24 DesiredCapabilities caps = new DesiredCapabilities();25 // platforms26 if (platform.equalsIgnoreCase("Windows"))27 caps.setPlatform(Platform.WINDOWS);28 if (platform.equalsIgnoreCase("Mac"))29 caps.setPlatform(Platform.MAC);30 if (platform.equalsIgnoreCase("Linux"))31 caps.setPlatform(Platform.LINUX);32 // browser33 if (browser.equalsIgnoreCase("Firefox"))34 caps = DesiredCapabilities.firefox();35 if (browser.equalsIgnoreCase("Chrome"))36 caps = DesiredCapabilities.chrome();37 if (browser.equalsIgnoreCase("Internet Explorer")) {38 caps = DesiredCapabilities.internetExplorer();39 caps.setCapability("ignoreZoomSetting", true);40 }41 // caps.setVersion(version);42 try {43 webDriver = new RemoteWebDriver(new URL(44 "http://134.171.18.124:4444/wd/hub"), caps);45 } catch (UnreachableBrowserException e) {...

Full Screen

Full Screen

Source:GridEg.java Github

copy

Full Screen

...17 DesiredCapabilities cap=null;18 if (br.equalsIgnoreCase("firefox"))19 {20 cap=DesiredCapabilities.firefox();21 cap.setPlatform(Platform.WINDOWS);22 }23 else if (br.equalsIgnoreCase("chrome"))24 {25 cap=DesiredCapabilities.chrome();26 cap.setPlatform(Platform.WINDOWS);27 }28 29// DesiredCapabilities cap=DesiredCapabilities.firefox();30// cap.setPlatform(Platform.WINDOWS);31 32// DesiredCapabilities cap=DesiredCapabilities.chrome();33// cap.setPlatform(Platform.WINDOWS);34 35 36 WebDriver driver=new RemoteWebDriver(new URL("http://192.168.0.3:4444/wd/hub"), cap);37 38 driver.get("http://orangehrm.qedgetech.com");39 driver.manage().window().maximize();40 41 driver.findElement(By.id("txtUsername")).sendKeys("Admin");42 driver.findElement(By.id("txtPassword")).sendKeys("Admin");43 driver.findElement(By.id("btnLogin")).click();44 45 Thread.sleep(5000);46 47 driver.findElement(By.partialLinkText("Welcome")).click();...

Full Screen

Full Screen

Source:BaseTest.java Github

copy

Full Screen

...16 DesiredCapabilities cap = null;17 if(browser.equals("Mozilla")) {18 cap = new DesiredCapabilities();19 cap.setBrowserName("firefox");20 cap.setPlatform(Platform.WINDOWS);21 }else if(browser.equals("Chrome")) {22 cap = new DesiredCapabilities();23 cap.setBrowserName("chrome");24 cap.setPlatform(Platform.WINDOWS);25 }else if(browser.equals("IE")) {26 cap = new DesiredCapabilities();27 cap.setBrowserName("iexplore");28 cap.setPlatform(Platform.WINDOWS);29 }30 31 try {32 driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);33 } catch (MalformedURLException e) {34 // TODO Auto-generated catch block35 e.printStackTrace();36 }37 }38 39 @AfterTest40 public void quit() {41 if(driver!=null)42 driver.quit();...

Full Screen

Full Screen

setPlatform

Using AI Code Generation

copy

Full Screen

1DesiredCapabilities capabilities = DesiredCapabilities.chrome();2capabilities.setPlatform(Platform.WINDOWS);3DesiredCapabilities capabilities = DesiredCapabilities.chrome();4capabilities.setCapability(CapabilityType.PLATFORM, Platform.WINDOWS);5WebDriver driver = new ChromeDriver(new DesiredCapabilities(Platform.WINDOWS));6ChromeOptions options = new ChromeOptions();7options.setCapability(CapabilityType.PLATFORM, Platform.WINDOWS);8WebDriver driver = new ChromeDriver(options);9ChromeOptions options = new ChromeOptions();10options.setPlatform(Platform.WINDOWS);11WebDriver driver = new ChromeDriver(options);12ChromeOptions options = new ChromeOptions();13options.addArguments("platform=windows");14WebDriver driver = new ChromeDriver(options);15ChromeOptions options = new ChromeOptions();16options.addArguments("--platform=windows");17WebDriver driver = new ChromeDriver(options);18ChromeOptions options = new ChromeOptions();19options.setExperimentalOption("platform", "windows");20WebDriver driver = new ChromeDriver(options);21ChromeOptions options = new ChromeOptions();22options.setExperimentalOption("platformName", "windows");23WebDriver driver = new ChromeDriver(options);24ChromeOptions options = new ChromeOptions();25options.setExperimentalOption("platform", Platform.WINDOWS);26WebDriver driver = new ChromeDriver(options);27ChromeOptions options = new ChromeOptions();28options.setExperimentalOption("platformName", Platform.WINDOWS);29WebDriver driver = new ChromeDriver(options);30ChromeOptions options = new ChromeOptions();31options.setExperimentalOption("capabilities", ImmutableMap.of("platform", "windows"));32WebDriver driver = new ChromeDriver(options);33ChromeOptions options = new ChromeOptions();34options.setExperimentalOption("capabilities", ImmutableMap.of("platform", Platform.WINDOWS));35WebDriver driver = new ChromeDriver(options);36ChromeOptions options = new ChromeOptions();

Full Screen

Full Screen

setPlatform

Using AI Code Generation

copy

Full Screen

1DesiredCapabilities capabilities = DesiredCapabilities.firefox();2capabilities.setPlatform(Platform.WINDOWS);3DesiredCapabilities capabilities = DesiredCapabilities.firefox();4capabilities.setCapability(CapabilityType.PLATFORM, Platform.WINDOWS);5DesiredCapabilities capabilities = DesiredCapabilities.firefox();6capabilities.setCapability("platform", Platform.WINDOWS);7DesiredCapabilities capabilities = DesiredCapabilities.firefox();8capabilities.setCapability(CapabilityType.PLATFORM, Platform.WINDOWS);9FirefoxOptions options = new FirefoxOptions();10options.setCapability("platform", Platform.WINDOWS);11FirefoxProfile profile = new FirefoxProfile();12profile.setCapability("platform", Platform.WINDOWS);13driver.setCapability("platform", Platform.WINDOWS);14ChromeOptions options = new ChromeOptions();15options.setCapability("platform", Platform.WINDOWS);16ChromeDriver driver = new ChromeDriver();17driver.setCapability("platform", Platform.WINDOWS);18ChromeDriverService service = new ChromeDriverService.Builder()19 .usingDriverExecutable(new File("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"))20 .usingAnyFreePort()21 .build();22service.start();23RemoteWebDriver driver = new RemoteWebDriver(service.getUrl(), DesiredCapabilities.chrome());24driver.setCapability("platform", Platform.WINDOWS);25InternetExplorerOptions options = new InternetExplorerOptions();26options.setCapability("platform", Platform.WINDOWS);27InternetExplorerDriver driver = new InternetExplorerDriver();28driver.setCapability("platform", Platform.WINDOWS

Full Screen

Full Screen

setPlatform

Using AI Code Generation

copy

Full Screen

1DesiredCapabilities capabilities = DesiredCapabilities.chrome();2capabilities.setPlatform(Platform.WINDOWS);3DesiredCapabilities capabilities = DesiredCapabilities.chrome();4capabilities.setCapability("platform", Platform.WINDOWS);5driver.setPlatform(Platform.WINDOWS);6driver.setCapability("platform", Platform.WINDOWS);7DesiredCapabilities capabilities = DesiredCapabilities.chrome();8capabilities.setPlatform(Platform.WINDOWS);9DesiredCapabilities capabilities = DesiredCapabilities.chrome();10capabilities.setCapability("platform", Platform.WINDOWS);11driver.setPlatform(Platform.WINDOWS);12driver.setCapability("platform", Platform.WINDOWS);13DesiredCapabilities capabilities = DesiredCapabilities.chrome();14capabilities.setPlatform(Platform.WINDOWS);15DesiredCapabilities capabilities = DesiredCapabilities.chrome();16capabilities.setCapability("platform", Platform.WINDOWS);17driver.setPlatform(Platform.WINDOWS);18driver.setCapability("

Full Screen

Full Screen

setPlatform

Using AI Code Generation

copy

Full Screen

1import org.openqa.selenium.remote.DesiredCapabilities;2import org.openqa.selenium.remote.RemoteWebDriver;3DesiredCapabilities capabilities = new DesiredCapabilities();4capabilities.setPlatform(Platform.WINDOWS);5import org.openqa.selenium.remote.DesiredCapabilities;6import org.openqa.selenium.remote.RemoteWebDriver;7DesiredCapabilities capabilities = new DesiredCapabilities();8capabilities.setCapability(CapabilityType.PLATFORM, Platform.WINDOWS);9import org.openqa.selenium.remote.DesiredCapabilities;10import org.openqa.selenium.remote.RemoteWebDriver;11DesiredCapabilities capabilities = new DesiredCapabilities();12capabilities.setCapability("platform", Platform.WINDOWS);13import org.openqa.selenium.remote.DesiredCapabilities;14import org.openqa.selenium.remote.RemoteWebDriver;15DesiredCapabilities capabilities = new DesiredCapabilities();16capabilities.setCapability("platform", Platform.WINDOWS);17import org.openqa.selenium.remote.DesiredCapabilities;18import org.openqa.selenium.remote.RemoteWebDriver;19DesiredCapabilities capabilities = new DesiredCapabilities();20capabilities.setCapability("platform", Platform.WINDOWS);21import org.openqa.selenium.remote.DesiredCapabilities;22import org.openqa.selenium.remote.RemoteWebDriver;23DesiredCapabilities capabilities = new DesiredCapabilities();24capabilities.setCapability("platform", Platform.WINDOWS);

Full Screen

Full Screen

setPlatform

Using AI Code Generation

copy

Full Screen

1import org.openqa.selenium.remote.DesiredCapabilities;2import org.openqa.selenium.remote.RemoteWebDriver;3DesiredCapabilities capabilities = new DesiredCapabilities();4capabilities.setPlatform(Platform.WINDOWS);5import org.openqa.selenium.remote.DesiredCapabilities;6import org.openqa.selenium.remote.RemoteWebDriver;7DesiredCapabilities capabilities = new DesiredCapabilities();8capabilities.setCapability(CapabilityType.PLATFORM, Platform.WINDOWS);9import org.openqa.selenium.remote.DesiredCapabilities;10import org.openqa.selenium.remote.RemoteWebDriver;11DesiredCapabilities capabilities = new DesiredCapabilities();12capabilities.setCapability("platform", Platform.WINDOWS);13import org.openqa.selenium.remote.DesiredCapabilities;14import org.openqa.selenium.remote.RemoteWebDriver;15DesiredCapabilities capabilities = new DesiredCapabilities();16capabilities.setCapability("platform", Platform.WINDOWS);17import org.openqa.selenium.remote.DesiredCapabilities;18import org.openqa.selenium.remote.RemoteWebDriver;19DesiredCapabilities capabilities = new DesiredCapabilities();20capabilities.setCapability("platform", Platform.WINDOWS);21import org.openqa.selenium.remote.DesiredCapabilities;22import org.openqa.selenium.remote.RemoteWebDriver;23DesiredCapabilities capabilities = new DesiredCapabilities();24capabilities.setCapability("platform", Platform.WINDOWS);

Full Screen

Full Screen

setPlatform

Using AI Code Generation

copy

Full Screen

1import org.openqa.selenium.remote.DesiredCapabilities 2DesiredCapabilities capabilities = DesiredCapabilities.chrome() 3capabilities.setPlatform(Platform.WINDOWS) 4import org.openqa.selenium.remote.DesiredCapabilities 5DesiredCapabilities capabilities = DesiredCapabilities.chrome() 6capabilities.setCapability("platform", Platform.WINDOWS) 7import org.openqa.selenium.remote.DesiredCapabilities 8DesiredCapabilities capabilities = DesiredCapabilities.chrome() 9capabilities.setCapability("platform", "WINDOWS") 10import org.openqa.selenium.remote.DesiredCapabilities 11DesiredCapabilities capabilities = DesiredCapabilities.chrome() 12capabilities.setCapability("platform", "WINDOWS") 13import org.openqa.selenium.remote.DesiredCapabilities 14DesiredCapabilities capabilities = DesiredCapabilities.chrome() 15capabilities.setPlatform(Platform.WINDOWS) 16import org.openqa.selenium.remote.DesiredCapabilities 17DesiredCapabilities capabilities = DesiredCapabilities.chrome() 18capabilities.setPlatform(Platform.WINDOWS) 19import org.openqa.selenium.remote.DesiredCapabilities 20DesiredCapabilities capabilities = DesiredCapabilities.chrome() 21capabilities.setCapability("platform", Platform.WINDOWS) 22import org.openqa.selenium.remote.DesiredCapabilities

Full Screen

Full Screen

setPlatform

Using AI Code Generation

copy

Full Screen

1DesiredCapabilities capabilities = new DesiredCapabilities();2capabilities.setPlatform(Platform.WINDOWS);3DesiredCapabilities capabilities = new DesiredCapabilities();4capabilities.setPlatform(Platform.WINDOWS);5DesiredCapabilities capabilities = nes DesiredCapabilities();6capabilities. =tPlatform(Platfo m.WINDOWS);7DesiredCapabilities capabilities = new DesiredCapabilities();8capabilities.setPlatform(Platform.WINDOWS);9DesiredCapabilities capabilities = new DesiredCapabilities();10capabilities.setPlatform(Platform.WINDOWS);11DesiredCapabilities capabilities = new DesiredCapabilities();12capabilities.setPlatform(Platform.WINDOWS);13DesiredCapabilities capabilities = new DesiredCapabilities();14capabilities.setPlatform(Platform.WINDOWS);15DesiredCapabilities capabilities = new DesiredCapabilities();16capabilities.setPlatform(Platform.WINDOWS);17DesiredCapabilities capabilities = new DesiredCapabilities();18capabilities.setPlatform(Platform.WINDOWS);19DesiredCapabilities capabilities = new DesiredCapabilities();20capabilities.setPlatform(Platform.WINDOWS);21DesiredCapabilities capabilities = new DesiredCapabilities();22capabilities.setPlatform(Platform.WINDOWS);23capabilities.setPlatform(Platform.WINDOWS);24capabilities.setVersion("10");25capabilities.setBrowserName("chrome");26capabilities.setCapability("name", "My First Test");27capabilities.setCapability("build", "1.0");28capabilities.setCapability("screenResolution", "1280x1024");29capabilities.setCapability("recordVideo", "true");30capabilities.setCapability("recordNetwork", "true");31capabilities.setCapability("browserstack.local", "true");32capabilities.setCapability("browserstack.localIdentifier", "Test123");33capabilities.setCapability("browserstack.selenium_version", "3.14.0");34capabilities.setCapability("browserstack.seleniumLogs", "true");35capabilities.setCapability("browserstack.debug", "true");36capabilities.setCapability("browserstack.console", "errors");37capabilities.setCapability("browserstack.networkLogs", "true");38capabilities.setCapability("browserstack.appium_version", "1.13.0");39capabilities.setCapability("browserstack.appiumLogs", "true");40capabilities.setCapability("browser

Full Screen

Full Screen

setPlatform

Using AI Code Generation

copy

Full Screen

1DesiredCapabilities capabilities = new DesiredCapabilities();2capabilities.setPlatform(Platform.WINDOWS);3DesiredCapabilities capabilities = new DesiredCapabilities();4capabilities.setPlatform(Platform.WINDOWS);5DesiredCapabilities capabilities = new DesiredCapabilities();6capabilities.setPlatform(Platform.WINDOWS);7DesiredCapabilities capabilities = new DesiredCapabilities();8capabilities.setPlatform(Platform.WINDOWS);9DesiredCapabilities capabilities = new DesiredCapabilities();10capabilities.setPlatform(Platform.WINDOWS);11DesiredCapabilities capabilities = new DesiredCapabilities();12capabilities.setPlatform(Platform.WINDOWS);13DesiredCapabilities capabilities = new DesiredCapabilities();14capabilities.setPlatform(Platform.WINDOWS);15DesiredCapabilities capabilities = new DesiredCapabilities();16capabilities.setPlatform(Platform.WINDOWS);17DesiredCapabilities capabilities = new DesiredCapabilities();18capabilities.setPlatform(Platform.WINDOWS);19DesiredCapabilities capabilities = new DesiredCapabilities();20capabilities.setPlatform(Platform.WINDOWS);21DesiredCapabilities capabilities = new DesiredCapabilities();22capabilities.setPlatform(Platform.WINDOWS);

Full Screen

Full Screen

Selenium 4 Tutorial:

LambdaTest’s Selenium 4 tutorial is covering every aspects of Selenium 4 testing with examples and best practices. Here you will learn basics, such as how to upgrade from Selenium 3 to Selenium 4, to some advanced concepts, such as Relative locators and Selenium Grid 4 for Distributed testing. Also will learn new features of Selenium 4, such as capturing screenshots of specific elements, opening a new tab or window on the browser, and new protocol adoptions.

Chapters:

  1. Upgrading From Selenium 3 To Selenium 4?: In this chapter, learn in detail how to update Selenium 3 to Selenium 4 for Java binding. Also, learn how to upgrade while using different build tools such as Maven or Gradle and get comprehensive guidance for upgrading Selenium.

  2. What’s New In Selenium 4 & What’s Being Deprecated? : Get all information about new implementations in Selenium 4, such as W3S protocol adaption, Optimized Selenium Grid, and Enhanced Selenium IDE. Also, learn what is deprecated for Selenium 4, such as DesiredCapabilites and FindsBy methods, etc.

  3. Selenium 4 With Python: Selenium supports all major languages, such as Python, C#, Ruby, and JavaScript. In this chapter, learn how to install Selenium 4 for Python and the features of Python in Selenium 4, such as Relative locators, Browser manipulation, and Chrom DevTool protocol.

  4. Selenium 4 Is Now W3C Compliant: JSON Wireframe protocol is retiring from Selenium 4, and they are adopting W3C protocol to learn in detail about the advantages and impact of these changes.

  5. How To Use Selenium 4 Relative Locator? : Selenium 4 came with new features such as Relative Locators that allow constructing locators with reference and easily located constructors nearby. Get to know its different use cases with examples.

  6. Selenium Grid 4 Tutorial For Distributed Testing: Selenium Grid 4 allows you to perform tests over different browsers, OS, and device combinations. It also enables parallel execution browser testing, reads up on various features of Selenium Grid 4 and how to download it, and runs a test on Selenium Grid 4 with best practices.

  7. Selenium Video Tutorials: Binge on video tutorials on Selenium by industry experts to get step-by-step direction from automating basic to complex test scenarios with Selenium.

Selenium 101 certifications:

LambdaTest also provides certification for Selenium testing to accelerate your career in Selenium automation testing.

Run Selenium automation tests on LambdaTest cloud grid

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful