How to use Enum ScreenOrientation class of org.openqa.selenium package

Best Selenium code snippet using org.openqa.selenium.Enum ScreenOrientation

Source:Device.java Github

copy

Full Screen

1package functional.tests.core.mobile.device;2import functional.tests.core.enums.DeviceType;3import functional.tests.core.enums.PlatformType;4import functional.tests.core.exceptions.DeviceException;5import functional.tests.core.exceptions.MobileAppException;6import functional.tests.core.log.LoggerBase;7import functional.tests.core.mobile.appium.Client;8import functional.tests.core.mobile.basetest.MobileContext;9import functional.tests.core.mobile.basetest.MobileSetupManager;10import functional.tests.core.mobile.device.android.AndroidDevice;11import functional.tests.core.mobile.device.ios.IOSDevice;12import functional.tests.core.mobile.element.UIElement;13import functional.tests.core.mobile.settings.MobileSettings;14import io.appium.java_client.ios.IOSDriver;15import io.appium.java_client.remote.HideKeyboardStrategy;16import org.openqa.selenium.By;17import org.openqa.selenium.Dimension;18import org.openqa.selenium.OutputType;19import org.openqa.selenium.ScreenOrientation;20import org.openqa.selenium.html5.Location;21import org.testng.Assert;22import javax.imageio.ImageIO;23import java.awt.image.BufferedImage;24import java.io.File;25import java.io.IOException;26import java.util.Arrays;27import java.util.List;28import java.util.concurrent.TimeoutException;29/**30 * Device abstraction.31 */32public class Device {33 private static final LoggerBase LOGGER_BASE = LoggerBase.getLogger("Device");34 private IDevice device;35 private MobileSettings settings;36 private Client client;37 private Dimension windowSize;38 /**39 * Init iOS device.40 *41 * @param client42 * @param settings43 */44 public Device(Client client, MobileSettings settings) {45 this.client = client;46 this.settings = settings;47 }48 /**49 * Get android device.50 *51 * @return AndroidDevice instance.52 */53 public AndroidDevice getAndroidDevice() {54 return (AndroidDevice) this.device;55 }56 /**57 * Get device.58 *59 * @return IOSDevice instance.60 */61 public IOSDevice getIOSDevice() {62 return (IOSDevice) this.device;63 }64 /**65 * Get device name.66 *67 * @return Name of current device.68 */69 public String getName() {70 return this.device.getName();71 }72 /**73 * Get device id.74 *75 * @return Device unique identifier.76 */77 public String getId() {78 return this.device.getId();79 }80 /**81 * Get device type.82 *83 * @return DeviceType enum value.84 */85 public DeviceType getType() {86 return this.device.getType();87 }88 /**89 * Start installed application with given package id.90 *91 * @param packageId PackageID of application.92 */93 public void startApplication(String packageId) {94 this.device.startApplication(packageId);95 }96 /**97 * Start device.98 * 1. Start device.99 * 2. Start appium session.100 * 3. Ensure app is running.101 *102 * @throws DeviceException When device is not available.103 * @throws TimeoutException When fail to start device in specified time.104 * @throws MobileAppException When app fail to start.105 */106 public void start() throws DeviceException, TimeoutException, MobileAppException {107 if (this.settings.platform == PlatformType.Android) {108 this.device = new AndroidDevice(this.client, this.settings);109 } else if (this.settings.platform == PlatformType.iOS) {110 this.device = new IOSDevice(this.client, this.settings);111 } else {112 String error = "No such device implemented";113 LOGGER_BASE.fatal(error);114 throw new DeviceException(error);115 }116 this.device = this.device.start();117 // Verify app is running.118 this.verifyAppRunning(this.settings.packageId);119 this.logAppStartupTime(this.settings.packageId);120 // Set windowSize121 this.windowSize = this.client.driver.manage().window().getSize();122 }123 /**124 * Stop device (kills emulator/simulator).125 */126 public void stop() throws DeviceException {127 this.device.stop();128 }129 /**130 * Push file from host machine to mobile device.131 *132 * @param localPath Full path to local file.133 * @param remotePath Remote folder.134 * @throws Exception When operation fails.135 */136 public void pushFile(String localPath, String remotePath) throws Exception {137 this.device.pushFile(localPath, remotePath);138 }139 /**140 * Pull file from mobile device to host machine.141 * destinationFolder is relative path based on this.settings.baseLogDir.142 * If destinationFolder is null then file will be saved in this.settings.baseLogDir143 *144 * @param remotePath Full path to remove file.145 * @param destinationFolder Path to host folder.146 * @throws Exception147 */148 public void pullFile(String remotePath, String destinationFolder) throws Exception {149 this.device.pullFile(remotePath, destinationFolder);150 }151 /**152 * Clean console logs.153 */154 public void cleanConsoleLog() {155 this.device.cleanConsoleLog();156 }157 /**158 * Write console logs in file.159 *160 * @param fileName file name (will be saved in default console log folder).161 * @throws IOException When fails to write in file.162 */163 public void writeConsoleLogToFile(String fileName) throws IOException {164 this.device.writeConsoleLogToFile(fileName);165 }166 /**167 * Assert log contains a string.168 *169 * @param str String that should be available in logs.170 * @throws IOException When fail to write current log (it first write it to disk and then get the content).171 */172 public void assertLogContains(String str) throws IOException {173 String testName = MobileSetupManager.getTestSetupManager().getContext().getTestName();174 String logContent = this.getLogContent(testName);175 Assert.assertTrue(logContent.contains(str), "The log does not contain '" + str + "'.");176 LOGGER_BASE.info("The log contains '" + str + "'.");177 }178 /**179 * Assert log does not contain a string.180 *181 * @param str String that should not be available in logs.182 * @throws IOException When fail to write current log (it first write it to disk and then get the content).183 */184 public void assertLogNotContains(String str) throws IOException {185 String testName = MobileSetupManager.getTestSetupManager().getContext().getTestName();186 String logContent = this.getLogContent(testName);187 Assert.assertFalse(logContent.contains(str), "The log contains '" + str + "'.");188 LOGGER_BASE.info("The log does not contains '" + str + "'.");189 }190 /**191 * Verify app is running.192 *193 * @param appId Package ID of application.194 * @throws MobileAppException195 */196 public void verifyAppRunning(String appId) throws MobileAppException {197 this.device.verifyAppRunning(appId);198 }199 /**200 * Check if app is running.201 *202 * @param appId Package ID of application.203 * @return True if app is running and False when it is not.204 */205 public boolean isAppRunning(String appId) {206 return this.device.isAppRunning(appId);207 }208 /**209 * Startup time of application in ms.210 *211 * @param packageId PackageId of application.212 * @return Application startup time in ms.213 */214 public String getStartupTime(String packageId) {215 return this.device.getStartupTime(packageId);216 }217 /**218 * Memory usage of application in kB.219 *220 * @param packageId PackageId of application.221 * @return Current application memory usage in kB.222 */223 public int getMemUsage(String packageId) {224 return this.device.getMemUsage(packageId);225 }226 /**227 * Log perforamcne info such as memory usage, load time, app size in CSV file.228 *229 * @throws IOException When fail to write in csv file.230 */231 public void logPerfInfo() throws IOException {232 this.device.logPerfInfo();233 }234 /**235 * Log startup time info in CSV file. IOException is catched if fails to write in csv file or to get startup time.236 */237 public void logAppStartupTime(String packageId) {238 this.device.logAppStartupTime(packageId);239 }240 /**241 * Get console logs during execution of current test.242 *243 * @return Console log as string244 * @throws IOException When log fail to be writen in file.245 */246 private String getLogContent(String testName) throws IOException {247 this.writeConsoleLogToFile(testName);248 return this.device.getContent(testName);249 }250 /**251 * Restart app under test.252 */253 public void restartApp() {254 this.device.restartApp();255 }256 /**257 * Uninstall user application.258 */259 public void uninstallApps() throws DeviceException {260 this.device.uninstallApps();261 }262 /**263 * Set geo location.264 *265 * @param location Geo location.266 */267 public void setLocation(Location location) {268 this.device.setLocation(location);269 }270 /**271 * Run current application in background.272 *273 * @param seconds Seconds to run in background.274 */275 public void runAppInBackground(int seconds) {276 LOGGER_BASE.info("Run current app in background for " + seconds + " seconds.");277 this.device.runAppInBackGround(seconds);278 LOGGER_BASE.info("Bring " + this.settings.packageId + " to front.");279 }280 /**281 * Close current app.282 */283 public void closeApp() {284 this.device.closeApp();285 }286 /**287 * List of user apps (apps that are safe to be uninstalled).288 *289 * @return List of package ids.290 */291 public static List<String> uninstallAppsList() {292 // TODO(dtopuzov): Do not use hardcoded app names.293 return Arrays.asList("org.nativescript", "com.telerik");294 }295 /**296 * Get mobile device window size.297 *298 * @return Window size.299 */300 public Dimension getWindowSize() {301 return this.windowSize;302 }303 /**304 * Get current screen as BufferedImage.305 *306 * @return BufferedImage of mobile device. Null if getScreenshot fails.307 */308 public BufferedImage getScreenshot() {309 try {310 File screen = this.client.driver.getScreenshotAs(OutputType.FILE);311 BufferedImage image = ImageIO.read(screen);312 if (this.settings.automationName.equals("UiAutomator1")) {313 return image.getSubimage(0, 0, image.getWidth() - 2, image.getHeight() - 2);314 } else {315 return image;316 }317 } catch (Exception e) {318 LOGGER_BASE.error("Failed to take screenshot! May be appium driver is dead.");319 return null;320 }321 }322 /**323 * Rotate the device.324 *325 * @param screenOrientation ScreenOrientation enum value.326 */327 public void rotate(ScreenOrientation screenOrientation) {328 this.client.driver.rotate(screenOrientation);329 }330 public void hideKeyboard() {331 MobileContext mobileContext = MobileSetupManager.getTestSetupManager().getContext();332 if (this.settings.platform == PlatformType.Android) {333 try {334 this.client.getDriver().hideKeyboard();335 LOGGER_BASE.info("Hide heyboard.");336 } catch (Exception e) {337 LOGGER_BASE.info("Soft keyboard not present.");338 }339 } else {340 By doneButtonLocator = By.id("Done");341 By returnButtonLocator = By.id("Return");342 UIElement doneButton = mobileContext.find.byLocator(doneButtonLocator, 1);343 if (doneButton != null) {344 ((IOSDriver) mobileContext.client.getDriver()).hideKeyboard(HideKeyboardStrategy.PRESS_KEY, "Done");345 LOGGER_BASE.info("Hide keyboard with Done key.");346 } else if (mobileContext.find.byLocator(returnButtonLocator, 1) != null) {347 ((IOSDriver) mobileContext.client.getDriver()).hideKeyboard(HideKeyboardStrategy.PRESS_KEY, "Return");348 LOGGER_BASE.info("Hide keyboard with Return key.");349 } else {350 ((IOSDriver) mobileContext.client.getDriver()).hideKeyboard(HideKeyboardStrategy.TAP_OUTSIDE);351 LOGGER_BASE.info("Hide keyboard with tap outside.");352 }353 }354 }355}...

Full Screen

Full Screen

Source:ConcurrentAppiumService.java Github

copy

Full Screen

1package com.ui.service;2import com.test.AppiumScriptHandler;3import com.ui.page.base.BasePage;4import com.ui.service.drivers.Drivers;5import com.util.jaxb.GeneralUtils;6import com.util.log.ColoredLog;7import io.appium.java_client.AppiumDriver;8import io.appium.java_client.MobileElement;9import io.appium.java_client.TouchAction;10import org.apache.log4j.Logger;11import org.junit.Assert;12import org.openqa.selenium.By;13import org.openqa.selenium.ScreenOrientation;14import org.openqa.selenium.WebDriver;15import org.openqa.selenium.WebElement;16import java.util.concurrent.TimeUnit;17/**18 * Created by asih on 22/02/2015.19 */20//public class ConcurrentAppiumService extends AppiumService {21public class ConcurrentAppiumService extends UIService<WebElement, AppiumDriver> {22 private AppiumDriver driver = null;23// private static final Logger logger = Logger.getLogger(SeleniumService.class);24 private final long waitForPageSourceInterval = 500;25 private static String lastPageSource = "";26 private UiMode requestedScreenMode;27 public ConcurrentAppiumService() {28 }29// public ConcurrentAppiumService(){30// super();31//32// }33 public final void setDriver(Drivers deviceDriver, String capsFileFolder, AppiumScriptHandler.Machine machine, String port, String ip) {34 try {35 driver = Drivers.Appium.setDriver(deviceDriver, capsFileFolder, machine, port, ip);36 this.setDriver(driver);37 ColoredLog.printMessage(ColoredLog.LogLevel.INFO, "Setting browser to driver finished successfully. \n\t");38 } catch (Exception ex) {39 ColoredLog.printMessage(ColoredLog.LogLevel.ERROR, "Problem in setting browser to driver " + ex.getMessage());40 Assert.assertTrue(deviceDriver.name() + " driver was not created", false);41 }42 }43 public final void setDriver(AppiumDriver _driver) {44 driver = _driver;45 }46 public final void setDriver(AppiumDriver _driver, String msg) {47 driver = _driver;48 ColoredLog.printMessage(ColoredLog.LogLevel.INFO, msg);49 }50 public final void closeDriver() {51 super.setDriver(driver);52 super.closeDriver();53 }54 @Override55 public final WebElement findElement(By by, String elementName) {56 super.setDriver(driver);57 return super.findElement(by, elementName);58 }59 @Override60 public final WebElement findElement(By by) throws Exception {61 super.setDriver(driver);62 return super.findElement(by);63 }64 @Override65 public final synchronized void explicitWait(long explicitWait, By by) {66 super.setDriver(driver);67 super.explicitWait(explicitWait, by);68 }69 @Override70 public final synchronized void implicitWait(long implicitWait, TimeUnit time) {71 super.setDriver(driver);72 super.implicitWait(implicitWait, time);73 }74 public final boolean isElementVisible(WebElement element) {75 super.setDriver(driver);76 return super.isElementVisible(element);77 }78 public final synchronized void implicitWait(long implicitWait) {79 super.setDriver(driver);80 super.implicitWait(implicitWait);81 }82 @Override83 public final boolean IsElementPresent(By by) {84 super.setDriver(driver);85 return super.IsElementPresent(by);86 }87 @Override88 public <T extends BasePage> boolean initElement(T pageObject) {89 super.setDriver(driver);90 return super.initElement(pageObject);91 }92 @Override93 public final void openBrowser(String url) {94 super.setDriver(driver);95 super.openBrowser(url);96 }97 @Override98 public final void closeBrowser() throws Exception {99 super.setDriver(driver);100 super.closeBrowser();101 }102 public void isMsgInLocator(By by, String msg, String page){103 implicitWait(1500);104 WebElement elem = driver.findElement(by);105 Assert.assertEquals("MESSAGE VALIDATION : \"" + msg + "\" WAS NOT FOUND in page " + page, msg, elem.getText() );106 ColoredLog.printMessage(ColoredLog.LogLevel.INFO, "MESSAGE VALIDATION : \"" + msg + "\" WAS FOUND in page \"" + page + "\"");107 }108 public final void closeApp() throws Exception {109 driver.closeApp();110 }111 public final MobileElement scroll(String val) {112 try{113 return driver.scrollTo(val);114 }115 catch(Exception e){116 GeneralUtils.handleError("Can't find message", e);117 }118 return null;119 }120 public final String getPageSource(long timeOutInMilisec){121 implicitWait(1500);122 while ((driver.getPageSource() == null) ||123 (driver.getPageSource().equalsIgnoreCase(lastPageSource))){124 try {125 Thread.sleep(waitForPageSourceInterval);126 timeOutInMilisec -= waitForPageSourceInterval;127 if(timeOutInMilisec <= 0){128 GeneralUtils.handleError("Time out finished without finding results",129 new Exception("Time out finished without finding results"));130 return null;131 }132 }catch (InterruptedException e) {133 GeneralUtils.handleError("Error in wait for time out", e);134 }135 }136 return lastPageSource = driver.getPageSource();137 }138 public final void rotate(ScreenOrientation orientation){139 driver.rotate(orientation);140 }141 public void tap(int xLoc, int yLoc){142 try {143 new TouchAction(driver).tap(xLoc, yLoc).release().perform();144 }catch (Exception e){145 GeneralUtils.handleError("Tap failed", e);146 }147 }148 public WebElement getElementByText(By listLocator, String text){149 super.setDriver(driver);150 return super.getElementByText(listLocator, text);151 }152 private UiMode getRequestedScreenMode() {153 return requestedScreenMode;154 }155 public void setRequestedScreenMode(UiMode requestedScreenMode) {156 this.requestedScreenMode = requestedScreenMode;157 }158 public void activateSelectedActivity(WebElement elem, ModeActivity modeActivity, String input){159 if((getRequestedScreenMode() == (UiMode.PORTRAIT))){160 if(driver.getOrientation() != ScreenOrientation.PORTRAIT) {161 rotate(ScreenOrientation.PORTRAIT);162 }163 activate(elem, modeActivity, input);164 }165 if(getRequestedScreenMode() == UiMode.LANDSCAPE) {166 if (driver.getOrientation() != ScreenOrientation.LANDSCAPE) {167 rotate(ScreenOrientation.LANDSCAPE);168 }169 activate(elem, modeActivity, input);170 }171 if(getRequestedScreenMode() == UiMode.TRANSITION) {172 if (driver.getOrientation() == ScreenOrientation.LANDSCAPE) {173 rotate(ScreenOrientation.PORTRAIT);174 activate(elem, modeActivity, input);175 rotate(ScreenOrientation.LANDSCAPE);176 }else{177 rotate(ScreenOrientation.LANDSCAPE);178 activate(elem, modeActivity, input);179 rotate(ScreenOrientation.PORTRAIT);180 }181 }182 }183 private void activate(WebElement elem, ModeActivity modeActivity, String input){184 if(modeActivity.name().equalsIgnoreCase(ModeActivity.SEND_KEYS.name())) {185 elem.sendKeys(input);186 }else if(modeActivity.name().equalsIgnoreCase(ModeActivity.CLICK.name())) {187 elem.click();188 }189 }190 public WebDriver getDriver(){191 return driver;192 }193 public enum UiMode {194 PORTRAIT, LANDSCAPE, TRANSITION;195 }196 public enum ModeActivity {197 SEND_KEYS, CLICK;198 }199}...

Full Screen

Full Screen

Source:AppiumService.java Github

copy

Full Screen

1package com.ui.service;2import com.test.AppiumScriptHandler;3import com.ui.page.base.BasePage;4import com.ui.service.drivers.Drivers;5import com.util.jaxb.GeneralUtils;6import com.util.log.ColoredLog;7import io.appium.java_client.AppiumDriver;8import io.appium.java_client.MobileElement;9import io.appium.java_client.TouchAction;10import org.apache.log4j.Logger;11import org.junit.Assert;12import org.openqa.selenium.By;13import org.openqa.selenium.ScreenOrientation;14import org.openqa.selenium.WebDriver;15import org.openqa.selenium.WebElement;16import java.util.concurrent.TimeUnit;17/**18 * Created by asih on 22/02/2015.19 */20public class AppiumService extends UIService<WebElement, AppiumDriver> {21 private static volatile AppiumDriver driver = null;22 private static final AppiumService APPIUM_SERVICE_INSTANCE = new AppiumService();23// private static final Logger logger = Logger.getLogger(SeleniumService.class);24 private final long waitForPageSourceInterval = 500;25 private static String lastPageSource = "";26 private UiMode requestedScreenMode;27 public static AppiumService getInstance() {28 return APPIUM_SERVICE_INSTANCE;29 }30 private AppiumService(){31 }32 public final void setDriver(Drivers deviceDriver, String capsFileFolder, AppiumScriptHandler.Machine machine, String port, String ip) {33 try {34 driver = Drivers.Appium.setDriver(deviceDriver, capsFileFolder, machine, port, ip);35 this.setDriver(driver);36 ColoredLog.printMessage(ColoredLog.LogLevel.INFO, "Setting browser to driver finished successfully. \n\t");37 } catch (Exception ex) {38 ColoredLog.printMessage(ColoredLog.LogLevel.ERROR, "Problem in setting browser to driver " + ex.getMessage());39 Assert.assertTrue(deviceDriver.name() + " driver was not created", false);40 }41 }42 public final void setDriver(AppiumDriver _driver) {43 driver = _driver;44 }45 public final void closeDriver() {46 super.setDriver(driver);47 super.closeDriver();48 }49 @Override50 public final WebElement findElement(By by, String elementName) {51 super.setDriver(driver);52 return super.findElement(by, elementName);53 }54 @Override55 public final WebElement findElement(By by) throws Exception {56 super.setDriver(driver);57 return super.findElement(by);58 }59 @Override60 public final synchronized void explicitWait(long explicitWait, By by) {61 super.setDriver(driver);62 super.explicitWait(explicitWait, by);63 }64 @Override65 public final synchronized void implicitWait(long implicitWait, TimeUnit time) {66 super.setDriver(driver);67 super.implicitWait(implicitWait, time);68 }69 public final boolean isElementVisible(WebElement element) {70 super.setDriver(driver);71 return super.isElementVisible(element);72 }73 public final synchronized void implicitWait(long implicitWait) {74 super.setDriver(driver);75 super.implicitWait(implicitWait);76 }77 @Override78 public final boolean IsElementPresent(By by) {79 super.setDriver(driver);80 return super.IsElementPresent(by);81 }82 @Override83 public <T extends BasePage> boolean initElement(T pageObject) {84 super.setDriver(driver);85 return super.initElement(pageObject);86 }87 @Override88 public final void openBrowser(String url) {89 super.setDriver(driver);90 super.openBrowser(url);91 }92 @Override93 public final void closeBrowser() throws Exception {94 super.setDriver(driver);95 super.closeBrowser();96 }97 public void isMsgInLocator(By by, String msg, String page){98 implicitWait(1500);99 WebElement elem = driver.findElement(by);100 Assert.assertEquals("MESSAGE VALIDATION : \"" + msg + "\" WAS NOT FOUND in page " + page, msg, elem.getText() );101 ColoredLog.printMessage(ColoredLog.LogLevel.INFO, "MESSAGE VALIDATION : \"" + msg + "\" WAS FOUND in page \"" + page + "\"");102 }103 public final void closeApp() throws Exception {104 driver.closeApp();105 }106 public final MobileElement scroll(String val) {107 try{108 return driver.scrollTo(val);109 }110 catch(Exception e){111 GeneralUtils.handleError("Can't find message", e);112 }113 return null;114 }115 public final String getPageSource(long timeOutInMilisec){116 implicitWait(1500);117 while ((driver.getPageSource() == null) ||118 (driver.getPageSource().equalsIgnoreCase(lastPageSource))){119 try {120 Thread.sleep(waitForPageSourceInterval);121 timeOutInMilisec -= waitForPageSourceInterval;122 if(timeOutInMilisec <= 0){123 GeneralUtils.handleError("Time out finished without finding results",124 new Exception("Time out finished without finding results"));125 return null;126 }127 }catch (InterruptedException e) {128 GeneralUtils.handleError("Error in wait for time out", e);129 }130 }131 return lastPageSource = driver.getPageSource();132 }133 public final void rotate(ScreenOrientation orientation){134 driver.rotate(orientation);135 }136 public void tap(int xLoc, int yLoc){137 try {138 new TouchAction(driver).tap(xLoc, yLoc).release().perform();139 }catch (Exception e){140 GeneralUtils.handleError("Tap failed", e);141 }142 }143 public WebElement getElementByText(By listLocator, String text){144 super.setDriver(driver);145 return super.getElementByText(listLocator, text);146 }147 private UiMode getRequestedScreenMode() {148 return requestedScreenMode;149 }150 public void setRequestedScreenMode(UiMode requestedScreenMode) {151 this.requestedScreenMode = requestedScreenMode;152 }153 public void activateSelectedActivity(WebElement elem, ModeActivity modeActivity, String input){154 if((getRequestedScreenMode() == (UiMode.PORTRAIT))){155 if(driver.getOrientation() != ScreenOrientation.PORTRAIT) {156 rotate(ScreenOrientation.PORTRAIT);157 }158 activate(elem, modeActivity, input);159 }160 if(getRequestedScreenMode() == UiMode.LANDSCAPE) {161 if (driver.getOrientation() != ScreenOrientation.LANDSCAPE) {162 rotate(ScreenOrientation.LANDSCAPE);163 }164 activate(elem, modeActivity, input);165 }166 if(getRequestedScreenMode() == UiMode.TRANSITION) {167 if (driver.getOrientation() == ScreenOrientation.LANDSCAPE) {168 rotate(ScreenOrientation.PORTRAIT);169 activate(elem, modeActivity, input);170 rotate(ScreenOrientation.LANDSCAPE);171 }else{172 rotate(ScreenOrientation.LANDSCAPE);173 activate(elem, modeActivity, input);174 rotate(ScreenOrientation.PORTRAIT);175 }176 }177 }178 private void activate(WebElement elem, ModeActivity modeActivity, String input){179 if(modeActivity.name().equalsIgnoreCase(ModeActivity.SEND_KEYS.name())) {180 elem.sendKeys(input);181 }else if(modeActivity.name().equalsIgnoreCase(ModeActivity.CLICK.name())) {182 elem.click();183 }184 }185 public WebDriver getDriver(){186 return driver;187 }188 public enum UiMode {189 PORTRAIT, LANDSCAPE, TRANSITION;190 }191 public enum ModeActivity {192 SEND_KEYS, CLICK;193 }194}...

Full Screen

Full Screen

Source:QtWebKitDriver.java Github

copy

Full Screen

1/****************************************************************************2**3** Copyright © 1992-2014 Cisco and/or its affiliates. All rights reserved.4** All rights reserved.5** 6** $CISCO_BEGIN_LICENSE:APACHE$7**8** Licensed under the Apache License, Version 2.0 (the "License");9** you may not use this file except in compliance with the License.10** You may obtain a copy of the License at11** http://www.apache.org/licenses/LICENSE-2.012** Unless required by applicable law or agreed to in writing, software13** distributed under the License is distributed on an "AS IS" BASIS,14** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15** See the License for the specific language governing permissions and16** limitations under the License.17**18** $CISCO_END_LICENSE$19**20****************************************************************************/21/*22Copyright 2012 Selenium committers23Copyright 2012 Software Freedom Conservancy24Licensed under the Apache License, Version 2.0 (the "License");25you may not use this file except in compliance with the License.26You may obtain a copy of the License at27 http://www.apache.org/licenses/LICENSE-2.028Unless required by applicable law or agreed to in writing, software29distributed under the License is distributed on an "AS IS" BASIS,30WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.31See the License for the specific language governing permissions and32limitations under the License.33 */34package org.openqa.selenium.qtwebkit;35import java.net.MalformedURLException;36import java.net.URL;37import java.util.Map;38import com.google.common.collect.ImmutableMap;39import org.openqa.selenium.*;40import org.openqa.selenium.html5.AppCacheStatus;41import org.openqa.selenium.html5.ApplicationCache;42import org.openqa.selenium.html5.LocalStorage;43import org.openqa.selenium.html5.SessionStorage;44import org.openqa.selenium.html5.WebStorage;45import org.openqa.selenium.interactions.HasTouchScreen;46import org.openqa.selenium.interactions.HasMultiTouchScreen;47import org.openqa.selenium.interactions.TouchScreen;48import org.openqa.selenium.interactions.MultiTouchScreen;49import org.openqa.selenium.remote.*;50import org.openqa.selenium.remote.RemoteMultiTouchScreen;51import org.openqa.selenium.remote.html5.RemoteLocalStorage;52import org.openqa.selenium.remote.html5.RemoteSessionStorage;53/**54 * QtWebKitDriver implements BrowserConnection with some limitation - setOnline() can change55 * connection state only for currently opened windows. If new view will be open now, it sets online56 * by default (while doesn't receive a command explicitly).57 */58public class QtWebKitDriver extends RemoteWebDriver59 implements TakesScreenshot, WebStorage, Rotatable, ApplicationCache,60 HasMultiTouchScreen, Visualizer {61 private RemoteLocalStorage localStorage;62 private RemoteSessionStorage sessionStorage;63 private MultiTouchScreen multiTouchScreen;64 /**65 * Custom capability that defines support different view and qtVersion.66 * <p>In qtVersion important only first digit .67 */68 public final static String HYBRID = "hybrid";69 /**70 * Custom capability.71 * WD checks this caps, if it is not specified,72 * in case of attempt to create second session we get exception of "one session only",73 * otherwise prev session will be terminated without closing windows74 * and new session can reuse those windows75 */76 public final static String REUSE_UI = "reuseUI";77 public QtWebKitDriver(CommandExecutor executor, Capabilities desiredCapabilities,78 Capabilities requiredCapabilities) {79 super(executor, desiredCapabilities, requiredCapabilities);80 localStorage = new RemoteLocalStorage(getExecuteMethod());81 sessionStorage = new RemoteSessionStorage(getExecuteMethod());82 multiTouchScreen = new RemoteMultiTouchScreen(getExecuteMethod());83 }84 public QtWebKitDriver(CommandExecutor executor, Capabilities desiredCapabilities) {85 this(executor, desiredCapabilities, null);86 }87 public QtWebKitDriver(Capabilities desiredCapabilities) {88 this(createDefaultExecutor(), desiredCapabilities);89 }90 public QtWebKitDriver(URL remoteAddress, Capabilities desiredCapabilities,91 Capabilities requiredCapabilities) {92 this(new QtWebDriverExecutor(remoteAddress), desiredCapabilities, requiredCapabilities);93 }94 public QtWebKitDriver(URL remoteAddress, Capabilities desiredCapabilities) {95 this(new QtWebDriverExecutor(remoteAddress), desiredCapabilities, null);96 }97 public <X> X getScreenshotAs(OutputType<X> target) {98 // Get the screenshot as base64.99 String base64 = (String) execute(DriverCommand.SCREENSHOT).getValue();100 // ... and convert it.101 return target.convertFromBase64Png(base64);102 }103 @Override104 public LocalStorage getLocalStorage() {105 return localStorage;106 }107 @Override108 public SessionStorage getSessionStorage() {109 return sessionStorage;110 }111 @Override112 public void rotate(ScreenOrientation orientation) {113 execute(DriverCommand.SET_SCREEN_ORIENTATION, ImmutableMap.of("orientation", orientation));114 }115 @Override116 public ScreenOrientation getOrientation() {117 return ScreenOrientation.valueOf(118 (String) execute(DriverCommand.GET_SCREEN_ORIENTATION).getValue());119 }120 @Override121 public AppCacheStatus getStatus() {122 Long status = (Long) execute(DriverCommand.GET_APP_CACHE_STATUS).getValue();123 long st = status;124 return AppCacheStatus.getEnum((int)st);125 }126 @Override127 public MultiTouchScreen getMultiTouch() {128 return multiTouchScreen;129 }130 @Override131 public TouchScreen getTouch() {132 return multiTouchScreen;133 }134 @Override135 public String getVisualizerSource() {136 return (String) execute(QtWebKitDriverCommand.GET_VISUALIZER_SOURCE).getValue();137 }138 public static QtWebDriverExecutor createDefaultExecutor() {139 try{140 String ip = System.getProperty(QtWebDriverService.QT_DRIVER_EXE_PROPERTY);141 if (ip == null) {142 ip = "http://localhost:9517";143 System.setProperty(QtWebDriverService.QT_DRIVER_EXE_PROPERTY, ip);144 }145 URL url = new URL(ip);146 return new QtWebDriverExecutor(url);147 }148 catch (MalformedURLException e) {149 return new QtWebDriverServiceExecutor(QtWebDriverService.createDefaultService());150 }151 }152 public static QtWebDriverExecutor createExecutor(Map<String, String> environment) {153 return new QtWebDriverServiceExecutor(QtWebDriverService.createService(environment));154 }155}...

Full Screen

Full Screen

Source:AndroidDriver.java Github

copy

Full Screen

1/*2Copyright 2011 Selenium committers3Licensed under the Apache License, Version 2.0 (the "License");4you may not use this file except in compliance with the License.5You may obtain a copy of the License at6 http://www.apache.org/licenses/LICENSE-2.07Unless required by applicable law or agreed to in writing, software8distributed under the License is distributed on an "AS IS" BASIS,9WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.10See the License for the specific language governing permissions and11limitations under the License.12 */13package org.openqa.selenium.android;14import com.google.common.collect.ImmutableMap;15import org.openqa.selenium.Capabilities;16import org.openqa.selenium.HasTouchScreen;17import org.openqa.selenium.OutputType;18import org.openqa.selenium.Rotatable;19import org.openqa.selenium.ScreenOrientation;20import org.openqa.selenium.TakesScreenshot;21import org.openqa.selenium.TouchScreen;22import org.openqa.selenium.WebDriverException;23import org.openqa.selenium.html5.AppCacheStatus;24import org.openqa.selenium.html5.ApplicationCache;25import org.openqa.selenium.html5.BrowserConnection;26import org.openqa.selenium.html5.LocalStorage;27import org.openqa.selenium.html5.Location;28import org.openqa.selenium.html5.LocationContext;29import org.openqa.selenium.html5.SessionStorage;30import org.openqa.selenium.html5.WebStorage;31import org.openqa.selenium.remote.CapabilityType;32import org.openqa.selenium.remote.DesiredCapabilities;33import org.openqa.selenium.remote.DriverCommand;34import org.openqa.selenium.remote.FileDetector;35import org.openqa.selenium.remote.RemoteTouchScreen;36import org.openqa.selenium.remote.RemoteWebDriver;37import org.openqa.selenium.remote.html5.RemoteLocalStorage;38import org.openqa.selenium.remote.html5.RemoteLocationContext;39import org.openqa.selenium.remote.html5.RemoteSessionStorage;40import java.net.MalformedURLException;41import java.net.URL;42/**43 * A driver for running tests on an Android device or emulator.44 */45public class AndroidDriver extends RemoteWebDriver implements TakesScreenshot, Rotatable,46 BrowserConnection, HasTouchScreen, WebStorage, LocationContext, ApplicationCache {47 private TouchScreen touch;48 private RemoteLocalStorage localStorage;49 private RemoteSessionStorage sessionStorage;50 private RemoteLocationContext locationContext;51 /**52 * The default constructor assumes the remote server is listening at http://localhost:8080/wd/hub53 */54 public AndroidDriver() {55 this(getDefaultUrl());56 }57 public AndroidDriver(Capabilities ignored) {58 this();59 }60 public AndroidDriver(String remoteAddress) throws MalformedURLException {61 this(new URL(remoteAddress));62 }63 public AndroidDriver(DesiredCapabilities caps) {64 this(getDefaultUrl(), caps);65 }66 public AndroidDriver(URL remoteAddress) {67 super(remoteAddress, getAndroidCapabilities(null));68 init();69 }70 public AndroidDriver(URL url, DesiredCapabilities caps) {71 super(url, getAndroidCapabilities(caps));72 init();73 }74 private void init() {75 touch = new RemoteTouchScreen(getExecuteMethod());76 localStorage = new RemoteLocalStorage(getExecuteMethod());77 sessionStorage = new RemoteSessionStorage(getExecuteMethod());78 locationContext = new RemoteLocationContext(getExecuteMethod());79 }80 @Override81 public void setFileDetector(FileDetector detector) {82 throw new WebDriverException(83 "Setting the file detector only works on remote webdriver instances obtained " +84 "via RemoteWebDriver");85 }86 public <X> X getScreenshotAs(OutputType<X> target) throws WebDriverException {87 String base64Png = execute(DriverCommand.SCREENSHOT).getValue().toString();88 return target.convertFromBase64Png(base64Png);89 }90 public boolean isOnline() {91 return (Boolean) execute(DriverCommand.IS_BROWSER_ONLINE).getValue();92 }93 public void setOnline(boolean online) throws WebDriverException {94 execute(DriverCommand.SET_BROWSER_ONLINE, ImmutableMap.of("state", online));95 }96 private static DesiredCapabilities getAndroidCapabilities(DesiredCapabilities userPrefs) {97 DesiredCapabilities caps = DesiredCapabilities.android();98 caps.setCapability(CapabilityType.TAKES_SCREENSHOT, true);99 caps.setCapability(CapabilityType.ROTATABLE, true);100 caps.setCapability(CapabilityType.SUPPORTS_BROWSER_CONNECTION, true);101 if (userPrefs != null) {102 caps.merge(userPrefs);103 }104 return caps;105 }106 public void rotate(ScreenOrientation orientation) {107 execute(DriverCommand.SET_SCREEN_ORIENTATION, ImmutableMap.of("orientation", orientation));108 }109 public ScreenOrientation getOrientation() {110 return ScreenOrientation.valueOf(111 (String) execute(DriverCommand.GET_SCREEN_ORIENTATION).getValue());112 }113 private static URL getDefaultUrl() {114 try {115 return new URL("http://localhost:8080/wd/hub");116 } catch (MalformedURLException e) {117 throw new WebDriverException("Malformed default remote URL: " + e.getMessage());118 }119 }120 public TouchScreen getTouch() {121 return touch;122 }123 public LocalStorage getLocalStorage() {124 return localStorage;125 }126 public SessionStorage getSessionStorage() {127 return sessionStorage;128 }129 public Location location() {130 return locationContext.location();131 }132 public void setLocation(Location loc) {133 locationContext.setLocation(loc);134 }135 public AppCacheStatus getStatus() {136 String status = (String) execute(DriverCommand.GET_APP_CACHE_STATUS).getValue();137 return AppCacheStatus.getEnum(status);138 }139}...

Full Screen

Full Screen

Source:singleTestAppiumNative.java Github

copy

Full Screen

1package mobile.parallel.appiumClientTests.single;2import io.appium.java_client.AppiumDriver;3import io.appium.java_client.ios.IOSDriver;4import io.appium.java_client.remote.IOSMobileCapabilityType;5import io.appium.java_client.remote.MobileCapabilityType;6import mobile.drivers.NewAndroidDriver;7import mobile.drivers.NewIOSDriver;8import org.junit.After;9import org.junit.Before;10import org.junit.Test;11import org.openqa.selenium.By;12import org.openqa.selenium.ScreenOrientation;13import org.openqa.selenium.remote.DesiredCapabilities;14import utils.CloudServer;15import utils.Utilities;16import java.net.MalformedURLException;17import java.net.URL;18public class singleTestAppiumNative {19 //<docker-server-url>http://192.168.3.18:8080</docker-server-url>20 public AppiumDriver driver;21 DesiredCapabilities dc = new DesiredCapabilities();22 @Before23 public void setUp() throws MalformedURLException {24 CloudServer cs = new CloudServer(CloudServer.CloudServerNameEnum.QA);25 dc.setCapability("newSessionWaitTimeout", 500);26 dc.setCapability("accessKey", cs.ACCESSKEY);27// dc.setCapability("deviceQuery", "@os='ios'");28 dc.setCapability(MobileCapabilityType.UDID, "00008020-000C1D5A0E89002E");29// dc.setCapability("deviceName", "auto");30// dc.setCapability("appiumVersion", "1.10.0-p0");31// dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");32 dc.setCapability(MobileCapabilityType.APP, "cloud:com.experitest.ExperiBank");33 dc.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "com.experitest.ExperiBank");34 driver = new NewIOSDriver(new URL(cs.gridURL), dc);35 }36 @Test37 public void testExperitest() {38 driver.rotate(ScreenOrientation.PORTRAIT);39 System.out.println(driver.getPageSource());40// driver.findElement(By.xpath("//*[@name='usernameTextField']")).sendKeys("company");41// driver.findElement(By.xpath("//*[@name='passwordTextField']")).sendKeys("company");42// driver.findElement(By.xpath("//*[@name='loginButton']")).click();43// driver.findElement(By.xpath("//*[@name='makePaymentButton']")).click();44// driver.findElement(By.xpath("//*[@name='phoneTextField']")).sendKeys("0541234567");45// driver.findElement(By.xpath("//*[@name='nameTextField']")).sendKeys("Jon Snow");46// driver.findElement(By.xpath("//*[@name='amountTextField']")).sendKeys("50");47// driver.findElement(By.xpath("//*[@name='countryButton']")).click();48// driver.findElement(By.xpath("//*[@name='Switzerland']")).click();49// driver.findElement(By.xpath("//*[@name='sendPaymentButton']")).click();50// driver.findElement(By.xpath("//*[@name='Yes']")).click();51 }52 @After53 public void tearDown() {54 driver.quit();55 }56}...

Full Screen

Full Screen

Source:PropertyWebDriverProvider.java Github

copy

Full Screen

1package org.jbehave.web.selenium;2import static java.lang.Boolean.parseBoolean;3import java.util.Locale;4import org.openqa.selenium.WebDriver;5import org.openqa.selenium.chrome.ChromeDriver;6import org.openqa.selenium.firefox.FirefoxDriver;7import org.openqa.selenium.ie.InternetExplorerDriver;8import org.openqa.selenium.phantomjs.PhantomJSDriver;9/**10 * Provides WebDriver instances based on system property "browser":11 * <ul>12 * <li>"chrome": {@link ChromeDriver}</li>13 * <li>"firefox": {@link FirefoxDriver}</li>14 * <li>"ie": {@link InternetExplorerDriver}</li>15 * <li>"phantomjs": {@link PhantomJSDriver}</li>16 * </ul>17 * Property values are case-insensitive and defaults to "firefox" if no18 * "browser" system property is found.19 * <p>20 * The drivers also accept the following properties:21 * <ul>22 * <li>"android": "webdriver.android.url" and23 * "webdriver.android.screenOrientation", defaulting to24 * "http://localhost:8080/hub" and "portrait".</li>25 * <li>"htmlunit": "webdriver.htmlunit.javascriptEnabled", defaulting to "true".26 * </li>27 * </ul>28 */29public class PropertyWebDriverProvider extends DelegatingWebDriverProvider {30 public enum Browser {31 ANDROID, CHROME, FIREFOX, HTMLUNIT, IE, PHANTOMJS32 }33 public void initialize() {34 Browser browser = Browser.valueOf(Browser.class, System.getProperty("browser", "firefox").toUpperCase(usingLocale()));35 delegate.set(createDriver(browser));36 }37 private WebDriver createDriver(Browser browser) {38 switch (browser) {39 case ANDROID:40 return createAndroidDriver();41 default:42 return createChromeDriver();43 case FIREFOX:44 return createFirefoxDriver();45 case HTMLUNIT:46 case IE:47 return createInternetExplorerDriver();48 case PHANTOMJS:49 return createPhantomJSDriver();50 }51 }52 protected WebDriver createAndroidDriver() {53 throw new UnsupportedOperationException("AndroidDriver no longer supported by Selenium. Use Selendroid instead.");54 }55 protected ChromeDriver createChromeDriver() {56 return new ChromeDriver();57 }58 protected FirefoxDriver createFirefoxDriver() {59 return new FirefoxDriver();60 }61 protected InternetExplorerDriver createInternetExplorerDriver() {62 return new InternetExplorerDriver();63 }64 protected WebDriver createPhantomJSDriver() {65 return new PhantomJSDriver();66 }67 protected Locale usingLocale() {68 return Locale.getDefault();69 }70}...

Full Screen

Full Screen

Source:ScreenOrientation.java Github

copy

Full Screen

1package org.openqa.selenium;2public enum ScreenOrientation3{4 LANDSCAPE("landscape"), 5 PORTRAIT("portrait");6 7 private final String value;8 9 private ScreenOrientation(String value) {10 this.value = value;11 }12 13 public String value() {14 return value;15 }16}...

Full Screen

Full Screen

Enum ScreenOrientation

Using AI Code Generation

copy

Full Screen

1import org.openqa.selenium.ScreenOrientation;2import org.openqa.selenium.WebDriver;3import org.openqa.selenium.WebElement;4import org.openqa.selenium.remote.DesiredCapabilities;5import org.openqa.selenium.remote.RemoteWebDriver;6import org.openqa.selenium.support.ui.ExpectedConditions;7import org.openqa.selenium.support.ui.WebDriverWait;8import org.testng.annotations.AfterTest;9import org.testng.annotations.BeforeTest;10import org.testng.annotations.Test;11import java.net.URL;12import java.util.concurrent.TimeUnit;13public class AndroidNativeAppTest {14 private WebDriver driver;15 private WebElement element;16 public void setUp() throws Exception {17 DesiredCapabilities capabilities = new DesiredCapabilities();18 capabilities.setCapability("platformName", "Android");19 capabilities.setCapability("platformVersion", "7.1.1");20 capabilities.setCapability("deviceName", "Android Emulator");21 capabilities.setCapability("app", "

Full Screen

Full Screen

Enum ScreenOrientation

Using AI Code Generation

copy

Full Screen

1import org.openqa.selenium.ScreenOrientation;2import org.openqa.selenium.remote.DesiredCapabilities;3import org.openqa.selenium.remote.RemoteWebDriver;4import org.openqa.selenium.support.ui.WebDriverWait;5import org.testng.annotations.AfterTest;6import org.testng.annotations.BeforeTest;7import org.testng.annotations.Test;8import io.appium.java_client.android.AndroidDriver;9import io.appium.java_client.android.AndroidElement;10import io.appium.java_client.android.nativekey.AndroidKey;11import io.appium.java_client.android.nativekey.KeyEvent;12import io.appium.java_client.remote.MobileCapabilityType;13import io.appium.java_client.remote.MobilePlatform;14import io.appium.java_client.service.local.AppiumDriverLocalService;15import io.appium.java_client.service.local.AppiumServiceBuilder;16import io.appium.java_client.service.local.flags.GeneralServerFlag;17import java.io.File;18import java.net.MalformedURLException;19import java.net.URL;20import java.util.concurrent.TimeUnit;21public class AppiumTest {22 AppiumDriverLocalService service;23 AndroidDriver<AndroidElement> driver;24 WebDriverWait wait;25 DesiredCapabilities cap = new DesiredCapabilities();26 public void setUP() throws MalformedURLException {27 cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);28 cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Device");29 cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");30 cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 14);31 cap.setCapability(MobileCapabilityType.APP, System.getProperty("user.dir") + "/src/main/java/app/ApiDemos-debug.apk");32 startServer();

Full Screen

Full Screen

Enum ScreenOrientation

Using AI Code Generation

copy

Full Screen

1import io.appium.java_client.android.AndroidDriver;2import io.appium.java_client.android.AndroidElement;3import io.appium.java_client.android.connection.ConnectionState;4import io.appium.java_client.android.connection.ConnectionStateBuilder;5import io.appium.java_client.android.connection.ConnectionType;6import io.appium.java_client.android.connection.HasNetworkConnection;7import io.appium.java_client.android.nativekey.AndroidKey;8import io.appium.java_client.android.nativekey.KeyEvent;9import io.appium.java_client.android.nativekey.PressesKey;10import io.appium.java_client.android.nativekey.AndroidKey;11import io.appium.java_client.android.nativekey.KeyEvent;12import io.appium.java_client.android.nativekey.PressesKey;13import io.appium.java_client.android.nativekey.KeyEventFlag;14import io.appium.java_client.android.nativekey.AndroidKey;15import io.appium.java_client.android.nativekey.KeyEvent;16import io.appium.java_client.android.nativekey.PressesKey;17import io.appium.java_client.android.nativekey.KeyEventFlag;18import io.appium.java_client.android.nativekey.AndroidKey;19import io.appium.java_client.android.nativekey.KeyEvent;20import io.appium.java_client.android.nativekey.PressesKey;21import io.appium.java_client.android.nativekey.KeyEventFlag;22import io.appium.java_client.android.nativekey.AndroidKey;23import io.appium.java_client.android.nativekey.KeyEvent;24import io.appium.java_client.android.nativekey.PressesKey;25import io.appium.java_client.android.nativekey.KeyEventFlag;26import io.appium.java_client.android.nativekey.AndroidKey;27import io.appium.java_client.android.nativekey.KeyEvent;28import io.appium.java_client.android.nativekey.PressesKey;29import io.appium.java_client.android.nativekey.KeyEventFlag;30import io.appium.java_client.android.nativekey.AndroidKey;31import io.appium.java_client.android.nativekey.KeyEvent;32import io.appium.java_client.android.nativekey.PressesKey;33import io.appium.java_client.android.nativekey.KeyEventFlag;34import io.appium.java_client.android.nativekey.AndroidKey;35import io.appium.java_client.android.nativekey.KeyEvent;36import io.appium.java_client.android.nativekey.PressesKey;37import io.appium.java_client.android.nativekey.KeyEventFlag;38import

Full Screen

Full Screen
copy
1public MyClass() {2 this.dataMember = ServiceLocator.locate("some service");3}4
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.

...Most popular Stackoverflow questions on Enum-ScreenOrientation

Most used methods in Enum-ScreenOrientation

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful