Best SeLion code snippet using com.paypal.selion.internal.platform.grid.LocalGridManager.setupToBootList
Source:LocalGridManager.java
...29 private static List<LocalServerComponent> toBoot = new ArrayList<>();30 private LocalGridManager() {31 // Utility class. So hide the constructor32 }33 private static void setupToBootList() {34 if (!toBoot.isEmpty()) {35 return;36 }37 toBoot.add(new LocalHub());38 toBoot.add(new LocalNode());39 toBoot.add(new LocalIOSNode());40 toBoot.add(new LocalSelendroidNode());41 }42 private static void clearToBootList() {43 toBoot.clear();44 }45 private static boolean isRunLocally() {46 return (Config.getBoolConfigProperty(ConfigProperty.SELENIUM_RUN_LOCALLY));47 }48 /**49 * This method is responsible for spawning a local hub for supporting local executions50 * 51 * @param testSession52 * - A {@link AbstractTestSession} that represents the type of test session to start (mobile or web).53 * 54 */55 public static synchronized void spawnLocalHub(AbstractTestSession testSession) {56 LOGGER.entering(testSession.getPlatform());57 if (!isRunLocally()) {58 LOGGER.exiting();59 return;60 }61 setupToBootList();62 for (LocalServerComponent eachItem : toBoot) {63 try {64 eachItem.boot(testSession);65 } catch (Exception e) { //NOSONAR66 // If either the Grid or the Node failed to start at the first attempt then there is NO point in trying67 // to keep restarting it for every iteration. So lets log a severe message and exit the JVM.68 LOGGER.log(Level.SEVERE, e.getMessage(), e);69 System.exit(1);70 }71 }72 LOGGER.exiting();73 }74 /**75 * This method helps shut down the already spawned hub for local runs...
setupToBootList
Using AI Code Generation
1import com.paypal.selion.internal.platform.grid.LocalGridManager;2public class TestLocalGridManager {3 public static void main(String[] args) {4 LocalGridManager.setupToBootList("firefox");5 LocalGridManager.setupToBootList("chrome");6 System.out.println(LocalGridManager.getToBootList());7 }8}
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!