How to use fromString method of org.openqa.selenium.Enum PageLoadStrategy class

Best Selenium code snippet using org.openqa.selenium.Enum PageLoadStrategy.fromString

Run Selenium automation tests on LambdaTest cloud grid

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

copy
1// Licensed to the Software Freedom Conservancy (SFC) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The SFC licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9//   http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied.  See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18package org.openqa.selenium;
19
20public enum PageLoadStrategy {
21
22  NONE ("none"),
23  EAGER ("eager"),
24  NORMAL ("normal")
25  ;
26
27  private String text;
28
29  private PageLoadStrategy(String text) {
30    this.text = text;
31  }
32
33  @Override
34  public String toString() {
35    return String.valueOf(text);
36  }
37
38  public static PageLoadStrategy fromString(String text) {
39    if (text != null) {
40      for (PageLoadStrategy b : PageLoadStrategy.values()) {
41        if (text.equalsIgnoreCase(b.text)) {
42          return b;
43        }
44      }
45    }
46    return null;
47  }
48}
49
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Most used method in Enum-PageLoadStrategy

Trigger fromString code on LambdaTest Cloud Grid

Execute automation tests with fromString on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie