How to use getPlatform method of com.paypal.selion.testcomponents.AbstractPage class

Best SeLion code snippet using com.paypal.selion.testcomponents.AbstractPage.getPlatform

Source:AbstractPage.java Github

copy

Full Screen

...88 if (session != null && StringUtils.isNotBlank(session.getXmlTestName())) {89 LocalConfig lc = ConfigManager.getConfig(session.getXmlTestName());90 site = lc.getConfigProperty(ConfigProperty.SITE_LOCALE);91 if (Grid.getMobileTestSession() != null) {92 platform = Grid.getMobileTestSession().getPlatform();93 }94 }95 }96 /**97 * Load object map.98 */99 protected Map<String, String> getObjectMap() {100 if (isInitialized()) {101 return objectMap;102 }103 while (mapQueue.size() > 0) {104 String[] map = mapQueue.poll();105 String pageDomain = map[0];106 String pageClassName = map[1];107 Map<String, String> currentObjectMap;108 try {109 GuiMapReader dataProvider = GuiMapReaderFactory.getInstance(pageDomain, pageClassName);110 currentObjectMap = dataProvider.getGuiMap(site, platform);111 pageTitle = currentObjectMap.get("pageTitle");112 for (String key : currentObjectMap.keySet()) {113 if (key.endsWith("Container")) {114 objectContainerMap.put(key, dataProvider.getGuiMapForContainer(key, site));115 }116 }117 pageValidators.addAll(dataProvider.getPageValidators());118 pageLoadingValidators.addAll(dataProvider.getPageLoadingValidators());119 if (objectMap != null) {120 objectMap.putAll(currentObjectMap);121 } else {122 objectMap = currentObjectMap;123 }124 } catch (Exception e) {125 throw new RuntimeException("Unable to initialize page data for " + pageDomain + "/" + pageClassName126 + ". Root cause:" + e, e); // NOSONAR127 }128 }129 pageInitialized = true;130 return objectMap;131 }132 /**133 * Load object map. This method takes a HashMap<String, String> and uses it to populate the objectMap This is134 * intended to allow for the use of programmatically generated locators in addition to the yaml file format IDs and135 * Locators136 *137 * @param sourceMap138 * the source map139 */140 protected void loadObjectMap(Map<String, String> sourceMap) {141 if (sourceMap == null) {142 return;143 }144 if(sourceMap.isEmpty()){145 return;146 }147 if (sourceMap.containsKey("pageTitle")) {148 pageTitle = sourceMap.get("pageTitle");149 }150 if (objectMap == null) {151 objectMap = new HashMap<>();152 }153 objectMap.putAll(sourceMap);154 pageInitialized = true;155 }156 public void initPage(String pageDomain, String pageClassName, String siteLocale) {157 initPage(pageDomain, pageClassName);158 site = siteLocale;159 }160 public void initPage(String pageDomain, String pageClassName, WebDriverPlatform platform) {161 initPage(pageDomain, pageClassName);162 this.platform = platform;163 }164 public void initPage(String pageDomain, String pageClassName, String siteLocale, WebDriverPlatform platform) {165 initPage(pageDomain, pageClassName);166 site = siteLocale;167 this.platform = platform;168 }169 public boolean isInitialized() {170 return pageInitialized;171 }172 public String getExpectedPageTitle() {173 throw new UnsupportedOperationException("This operation is NOT supported.");174 }175 public String getSiteLocale() {176 return site;177 }178 public WebDriverPlatform getPlatform() {179 return platform;180 }181 public void validatePage() {182 throw new UnsupportedOperationException("This operation is NOT supported.");183 }184 public void checkIfLoaded() {185 throw new UnsupportedOperationException("This operation is NOT supported.");186 }187 public boolean isPageValidated() {188 throw new UnsupportedOperationException("This operation is NOT supported.");189 }190 public boolean isPageLoaded() {191 throw new UnsupportedOperationException("This operation is NOT supported.");192 }...

Full Screen

Full Screen

getPlatform

Using AI Code Generation

copy

Full Screen

1package com.paypal.selion.testcomponents;2import org.openqa.selenium.By;3import org.testng.Assert;4import org.testng.annotations.Test;5import com.paypal.selion.annotations.WebTest;6import com.paypal.selion.platform.grid.Grid;7import com.paypal.selion.platform.html.Label;8import com.paypal.selion.platform.html.WebPage;9public class AbstractPageTest extends AbstractPage {10 public void testGetPlatform() {11 WebPage page = new WebPage();12 page.switchToFrame("injectedUl");13 Assert.assertTrue(label.getText().contains("Welcome to PayPal"));14 Assert.assertEquals(getPlatform(), "desktop");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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful