How to use DefaultSlotSelector class of org.openqa.selenium.grid.distributor.selector package

Best Selenium code snippet using org.openqa.selenium.grid.distributor.selector.DefaultSlotSelector

Source:LocalDistributorTest.java Github

copy

Full Screen

...29import org.openqa.selenium.grid.data.NodeStatusEvent;30import org.openqa.selenium.grid.data.RequestId;31import org.openqa.selenium.grid.data.Session;32import org.openqa.selenium.grid.distributor.Distributor;33import org.openqa.selenium.grid.distributor.selector.DefaultSlotSelector;34import org.openqa.selenium.grid.node.Node;35import org.openqa.selenium.grid.node.local.LocalNode;36import org.openqa.selenium.grid.security.Secret;37import org.openqa.selenium.grid.sessionmap.local.LocalSessionMap;38import org.openqa.selenium.grid.sessionqueue.NewSessionQueue;39import org.openqa.selenium.grid.data.SessionRequest;40import org.openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue;41import org.openqa.selenium.grid.testing.TestSessionFactory;42import org.openqa.selenium.internal.Either;43import org.openqa.selenium.remote.HttpSessionId;44import org.openqa.selenium.remote.SessionId;45import org.openqa.selenium.remote.http.HttpClient;46import org.openqa.selenium.remote.http.HttpHandler;47import org.openqa.selenium.remote.http.HttpRequest;48import org.openqa.selenium.remote.http.HttpResponse;49import org.openqa.selenium.remote.tracing.DefaultTestTracer;50import org.openqa.selenium.remote.tracing.Tracer;51import java.io.UncheckedIOException;52import java.net.URI;53import java.net.URISyntaxException;54import java.time.Duration;55import java.time.Instant;56import java.util.ArrayList;57import java.util.List;58import java.util.Map;59import java.util.Optional;60import java.util.Set;61import java.util.UUID;62import java.util.concurrent.Callable;63import java.util.concurrent.Executors;64import java.util.concurrent.Future;65import java.util.concurrent.TimeUnit;66import static org.assertj.core.api.Assertions.assertThat;67import static org.assertj.core.api.Assertions.fail;68import static org.openqa.selenium.grid.data.Availability.DRAINING;69import static org.openqa.selenium.remote.Dialect.W3C;70import static org.openqa.selenium.remote.http.HttpMethod.GET;71public class LocalDistributorTest {72 private final Secret registrationSecret = new Secret("bavarian smoked");73 private Tracer tracer;74 private EventBus bus;75 private HttpClient.Factory clientFactory;76 private URI uri;77 private Node localNode;78 @Before79 public void setUp() throws URISyntaxException {80 tracer = DefaultTestTracer.createTracer();81 bus = new GuavaEventBus();82 clientFactory = HttpClient.Factory.createDefault();83 Capabilities caps = new ImmutableCapabilities("browserName", "cheese");84 uri = new URI("http://localhost:1234");85 localNode = LocalNode.builder(tracer, bus, uri, uri, registrationSecret)86 .add(caps, new TestSessionFactory((id, c) -> new Handler(c)))87 .maximumConcurrentSessions(2)88 .build();89 }90 @Test91 public void testAddNodeToDistributor() {92 NewSessionQueue queue = new LocalNewSessionQueue(93 tracer,94 bus,95 new DefaultSlotMatcher(),96 Duration.ofSeconds(2),97 Duration.ofSeconds(2),98 registrationSecret);99 Distributor distributor = new LocalDistributor(100 tracer,101 bus,102 clientFactory,103 new LocalSessionMap(tracer, bus),104 queue,105 new DefaultSlotSelector(),106 registrationSecret,107 Duration.ofMinutes(5),108 false);109 distributor.add(localNode);110 DistributorStatus status = distributor.getStatus();111 //Check the size112 final Set<NodeStatus> nodes = status.getNodes();113 assertThat(nodes.size()).isEqualTo(1);114 //Check a couple attributes115 NodeStatus distributorNode = nodes.iterator().next();116 assertThat(distributorNode.getId()).isEqualByComparingTo(localNode.getId());117 assertThat(distributorNode.getUri()).isEqualTo(uri);118 }119 @Test120 public void testShouldNotAddNodeWithWrongSecret() {121 Secret secret = new Secret("my_secret");122 NewSessionQueue queue = new LocalNewSessionQueue(123 tracer,124 bus,125 new DefaultSlotMatcher(),126 Duration.ofSeconds(2),127 Duration.ofSeconds(2),128 registrationSecret);129 Distributor secretDistributor = new LocalDistributor(130 tracer,131 bus,132 clientFactory,133 new LocalSessionMap(tracer, bus),134 queue,135 new DefaultSlotSelector(),136 secret,137 Duration.ofMinutes(5),138 false);139 bus.fire(new NodeStatusEvent(localNode.getStatus()));140 DistributorStatus status = secretDistributor.getStatus();141 //Check the size142 final Set<NodeStatus> nodes = status.getNodes();143 assertThat(nodes.size()).isEqualTo(0);144 }145 @Test146 public void testRemoveNodeFromDistributor() {147 NewSessionQueue queue = new LocalNewSessionQueue(148 tracer,149 bus,150 new DefaultSlotMatcher(),151 Duration.ofSeconds(2),152 Duration.ofSeconds(2),153 registrationSecret);154 Distributor distributor = new LocalDistributor(155 tracer,156 bus,157 clientFactory,158 new LocalSessionMap(tracer, bus),159 queue,160 new DefaultSlotSelector(),161 registrationSecret,162 Duration.ofMinutes(5),163 false);164 distributor.add(localNode);165 //Check the size166 DistributorStatus statusBefore = distributor.getStatus();167 final Set<NodeStatus> nodesBefore = statusBefore.getNodes();168 assertThat(nodesBefore.size()).isEqualTo(1);169 //Recheck the status--should be zero170 distributor.remove(localNode.getId());171 DistributorStatus statusAfter = distributor.getStatus();172 final Set<NodeStatus> nodesAfter = statusAfter.getNodes();173 assertThat(nodesAfter.size()).isEqualTo(0);174 }175 @Test176 public void testAddSameNodeTwice() {177 NewSessionQueue queue = new LocalNewSessionQueue(178 tracer,179 bus,180 new DefaultSlotMatcher(),181 Duration.ofSeconds(2),182 Duration.ofSeconds(2),183 registrationSecret);184 Distributor distributor = new LocalDistributor(185 tracer,186 bus,187 clientFactory,188 new LocalSessionMap(tracer, bus),189 queue,190 new DefaultSlotSelector(),191 registrationSecret,192 Duration.ofMinutes(5),193 false);194 distributor.add(localNode);195 distributor.add(localNode);196 DistributorStatus status = distributor.getStatus();197 //Should only be one node after dupe check198 final Set<NodeStatus> nodes = status.getNodes();199 assertThat(nodes.size()).isEqualTo(1);200 }201 @Test202 public void shouldBeAbleToAddMultipleSessionsConcurrently() throws Exception {203 NewSessionQueue queue = new LocalNewSessionQueue(204 tracer,205 bus,206 new DefaultSlotMatcher(),207 Duration.ofSeconds(2),208 Duration.ofSeconds(2),209 registrationSecret);210 LocalDistributor distributor = new LocalDistributor(211 tracer,212 bus,213 clientFactory,214 new LocalSessionMap(tracer, bus),215 queue,216 new DefaultSlotSelector(),217 registrationSecret,218 Duration.ofMinutes(5),219 false);220 // Add one node to ensure that everything is created in that.221 Capabilities caps = new ImmutableCapabilities("browserName", "cheese");222 class VerifyingHandler extends Session implements HttpHandler {223 private VerifyingHandler(SessionId id, Capabilities capabilities) {224 super(id, uri, new ImmutableCapabilities(), capabilities, Instant.now());225 }226 @Override227 public HttpResponse execute(HttpRequest req) {228 Optional<SessionId> id = HttpSessionId.getSessionId(req.getUri()).map(SessionId::new);229 assertThat(id).isEqualTo(Optional.of(getId()));230 return new HttpResponse();231 }232 }233 // Only use one node.234 Node node = LocalNode.builder(tracer, bus, uri, uri, registrationSecret)235 .add(caps, new TestSessionFactory(VerifyingHandler::new))236 .add(caps, new TestSessionFactory(VerifyingHandler::new))237 .add(caps, new TestSessionFactory(VerifyingHandler::new))238 .maximumConcurrentSessions(3)239 .build();240 distributor.add(node);241 SessionRequest sessionRequest =242 new SessionRequest(243 new RequestId(UUID.randomUUID()),244 Instant.now(),245 Set.of(W3C),246 Set.of(new ImmutableCapabilities("browserName", "cheese")),247 Map.of(),248 Map.of());249 List<Callable<SessionId>> callables = new ArrayList<>();250 for (int i = 0; i < 3; i++) {251 callables.add(() -> {252 Either<SessionNotCreatedException, CreateSessionResponse> result =253 distributor.newSession(sessionRequest);254 if (result.isRight()) {255 CreateSessionResponse res = result.right();256 assertThat(res.getSession().getCapabilities().getBrowserName()).isEqualTo("cheese");257 return res.getSession().getId();258 } else {259 fail("Session creation failed", result.left());260 }261 return null;262 });263 }264 List<Future<SessionId>> futures = Executors.newFixedThreadPool(3).invokeAll(callables);265 for (Future<SessionId> future : futures) {266 SessionId id = future.get(2, TimeUnit.SECONDS);267 // Now send a random command.268 HttpResponse res = node.execute(new HttpRequest(GET, String.format("/session/%s/url", id)));269 assertThat(res.isSuccessful()).isTrue();270 }271 }272 @Test273 public void testDrainNodeFromDistributor() {274 NewSessionQueue queue = new LocalNewSessionQueue(275 tracer,276 bus,277 new DefaultSlotMatcher(),278 Duration.ofSeconds(2),279 Duration.ofSeconds(2),280 registrationSecret);281 Distributor distributor = new LocalDistributor(282 tracer,283 bus,284 clientFactory,285 new LocalSessionMap(tracer, bus),286 queue,287 new DefaultSlotSelector(),288 registrationSecret,289 Duration.ofMinutes(5),290 false);291 distributor.add(localNode);292 assertThat(localNode.isDraining()).isFalse();293 //Check the size - there should be one node294 DistributorStatus statusBefore = distributor.getStatus();295 Set<NodeStatus> nodesBefore = statusBefore.getNodes();296 assertThat(nodesBefore.size()).isEqualTo(1);297 NodeStatus nodeBefore = nodesBefore.iterator().next();298 assertThat(nodeBefore.getAvailability()).isNotEqualTo(DRAINING);299 distributor.drain(localNode.getId());300 assertThat(localNode.isDraining()).isTrue();301 //Recheck the status - there should still be no node, it is removed302 DistributorStatus statusAfter = distributor.getStatus();303 Set<NodeStatus> nodesAfter = statusAfter.getNodes();304 assertThat(nodesAfter.size()).isEqualTo(0);305 }306 @Test307 public void testDrainNodeFromNode() {308 assertThat(localNode.isDraining()).isFalse();309 NewSessionQueue queue = new LocalNewSessionQueue(310 tracer,311 bus,312 new DefaultSlotMatcher(),313 Duration.ofSeconds(2),314 Duration.ofSeconds(2),315 registrationSecret);316 Distributor distributor = new LocalDistributor(317 tracer,318 bus,319 clientFactory,320 new LocalSessionMap(tracer, bus),321 queue,322 new DefaultSlotSelector(),323 registrationSecret,324 Duration.ofMinutes(5),325 false);326 distributor.add(localNode);327 localNode.drain();328 assertThat(localNode.isDraining()).isTrue();329 }330 private class Handler extends Session implements HttpHandler {331 private Handler(Capabilities capabilities) {332 super(new SessionId(UUID.randomUUID()), uri, new ImmutableCapabilities(), capabilities, Instant.now());333 }334 @Override335 public HttpResponse execute(HttpRequest req) throws UncheckedIOException {336 return new HttpResponse();...

Full Screen

Full Screen

Source:NewSessionCreationTest.java Github

copy

Full Screen

...30import org.openqa.selenium.grid.data.DefaultSlotMatcher;31import org.openqa.selenium.grid.data.Session;32import org.openqa.selenium.grid.distributor.Distributor;33import org.openqa.selenium.grid.distributor.local.LocalDistributor;34import org.openqa.selenium.grid.distributor.selector.DefaultSlotSelector;35import org.openqa.selenium.grid.node.Node;36import org.openqa.selenium.grid.node.local.LocalNode;37import org.openqa.selenium.grid.security.Secret;38import org.openqa.selenium.grid.server.BaseServerOptions;39import org.openqa.selenium.grid.server.Server;40import org.openqa.selenium.grid.sessionmap.SessionMap;41import org.openqa.selenium.grid.sessionmap.local.LocalSessionMap;42import org.openqa.selenium.grid.sessionqueue.NewSessionQueue;43import org.openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue;44import org.openqa.selenium.grid.testing.TestSessionFactory;45import org.openqa.selenium.grid.web.CombinedHandler;46import org.openqa.selenium.grid.web.EnsureSpecCompliantHeaders;47import org.openqa.selenium.netty.server.NettyServer;48import org.openqa.selenium.remote.http.Contents;49import org.openqa.selenium.remote.http.HttpClient;50import org.openqa.selenium.remote.http.HttpRequest;51import org.openqa.selenium.remote.http.HttpResponse;52import org.openqa.selenium.remote.http.Routable;53import org.openqa.selenium.remote.tracing.DefaultTestTracer;54import org.openqa.selenium.remote.tracing.Tracer;55import org.openqa.selenium.testing.drivers.Browser;56import java.net.URI;57import java.net.URISyntaxException;58import java.time.Duration;59import java.time.Instant;60import java.util.concurrent.atomic.AtomicInteger;61import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;62import static org.assertj.core.api.Assertions.assertThat;63import static org.openqa.selenium.json.Json.JSON_UTF_8;64import static org.openqa.selenium.remote.http.Contents.asJson;65import static org.openqa.selenium.remote.http.HttpMethod.POST;66public class NewSessionCreationTest {67 private Tracer tracer;68 private EventBus events;69 private HttpClient.Factory clientFactory;70 private Secret registrationSecret;71 private Server<?> server;72 @Before73 public void setup() {74 tracer = DefaultTestTracer.createTracer();75 events = new GuavaEventBus();76 clientFactory = HttpClient.Factory.createDefault();77 registrationSecret = new Secret("hereford hop");78 }79 @After80 public void stopServer() {81 server.stop();82 }83 @Test84 public void ensureJsCannotCreateANewSession() throws URISyntaxException {85 SessionMap sessions = new LocalSessionMap(tracer, events);86 NewSessionQueue queue = new LocalNewSessionQueue(87 tracer,88 events,89 new DefaultSlotMatcher(),90 Duration.ofSeconds(2),91 Duration.ofSeconds(2),92 registrationSecret);93 Distributor distributor = new LocalDistributor(94 tracer,95 events,96 clientFactory,97 sessions,98 queue,99 new DefaultSlotSelector(),100 registrationSecret,101 Duration.ofMinutes(5),102 false);103 Routable router = new Router(tracer, clientFactory, sessions, queue, distributor)104 .with(new EnsureSpecCompliantHeaders(ImmutableList.of(), ImmutableSet.of()));105 server = new NettyServer(106 new BaseServerOptions(new MapConfig(ImmutableMap.of())),107 router,108 new ProxyCdpIntoGrid(clientFactory, sessions))109 .start();110 URI uri = server.getUrl().toURI();111 Node node = LocalNode.builder(112 tracer,113 events,114 uri,115 uri,116 registrationSecret)117 .add(118 Browser.detect().getCapabilities(),119 new TestSessionFactory(120 (id, caps) ->121 new Session(id, uri, Browser.detect().getCapabilities(), caps, Instant.now())))122 .build();123 distributor.add(node);124 try (HttpClient client = HttpClient.Factory.createDefault().createClient(server.getUrl())) {125 // Attempt to create a session with an origin header but content type set126 HttpResponse res = client.execute(127 new HttpRequest(POST, "/session")128 .addHeader("Content-Type", JSON_UTF_8)129 .addHeader("Origin", "localhost")130 .setContent(Contents.asJson(ImmutableMap.of(131 "capabilities", ImmutableMap.of(132 "alwaysMatch", Browser.detect().getCapabilities())))));133 assertThat(res.getStatus()).isEqualTo(HTTP_INTERNAL_ERROR);134 // And now make sure the session is just fine135 res = client.execute(136 new HttpRequest(POST, "/session")137 .addHeader("Content-Type", JSON_UTF_8)138 .setContent(Contents.asJson(ImmutableMap.of(139 "capabilities", ImmutableMap.of(140 "alwaysMatch", Browser.detect().getCapabilities())))));141 assertThat(res.isSuccessful()).isTrue();142 }143 }144 @Test145 public void shouldNotRetryNewSessionRequestOnUnexpectedError() throws URISyntaxException {146 Capabilities capabilities = new ImmutableCapabilities("browserName", "cheese");147 URI nodeUri = new URI("http://localhost:4444");148 CombinedHandler handler = new CombinedHandler();149 SessionMap sessions = new LocalSessionMap(tracer, events);150 handler.addHandler(sessions);151 NewSessionQueue queue = new LocalNewSessionQueue(152 tracer,153 events,154 new DefaultSlotMatcher(),155 Duration.ofSeconds(2),156 Duration.ofSeconds(10),157 registrationSecret);158 handler.addHandler(queue);159 Distributor distributor = new LocalDistributor(160 tracer,161 events,162 clientFactory,163 sessions,164 queue,165 new DefaultSlotSelector(),166 registrationSecret,167 Duration.ofMinutes(5),168 false);169 handler.addHandler(distributor);170 AtomicInteger count = new AtomicInteger();171 // First session creation attempt throws an error.172 // Does not reach second attempt.173 TestSessionFactory sessionFactory = new TestSessionFactory((id, caps) -> {174 if (count.get() == 0) {175 count.incrementAndGet();176 throw new SessionNotCreatedException("Expected the exception");177 } else {178 return new Session(179 id,180 nodeUri,181 new ImmutableCapabilities(),182 caps,183 Instant.now());184 }185 });186 LocalNode localNode = LocalNode.builder(tracer, events, nodeUri, nodeUri, registrationSecret)187 .add(capabilities, sessionFactory).build();188 handler.addHandler(localNode);189 distributor.add(localNode);190 Router router = new Router(tracer, clientFactory, sessions, queue, distributor);191 handler.addHandler(router);192 server = new NettyServer(193 new BaseServerOptions(194 new MapConfig(ImmutableMap.of())),195 handler);196 server.start();197 HttpRequest request = new HttpRequest(POST, "/session");198 request.setContent(asJson(199 ImmutableMap.of(200 "capabilities", ImmutableMap.of(201 "alwaysMatch", capabilities))));202 HttpClient client = clientFactory.createClient(server.getUrl());203 HttpResponse httpResponse = client.execute(request);204 assertThat(httpResponse.getStatus()).isEqualTo(HTTP_INTERNAL_ERROR);205 }206 @Test(timeout = 5000L)207 public void shouldRejectRequestForUnsupportedCaps() throws URISyntaxException {208 Capabilities capabilities = new ImmutableCapabilities("browserName", "cheese");209 URI nodeUri = new URI("http://localhost:4444");210 CombinedHandler handler = new CombinedHandler();211 SessionMap sessions = new LocalSessionMap(tracer, events);212 handler.addHandler(sessions);213 NewSessionQueue queue = new LocalNewSessionQueue(214 tracer,215 events,216 new DefaultSlotMatcher(),217 Duration.ofSeconds(5),218 Duration.ofSeconds(60),219 registrationSecret);220 handler.addHandler(queue);221 Distributor distributor = new LocalDistributor(222 tracer,223 events,224 clientFactory,225 sessions,226 queue,227 new DefaultSlotSelector(),228 registrationSecret,229 Duration.ofMinutes(5),230 true);231 handler.addHandler(distributor);232 TestSessionFactory sessionFactory = new TestSessionFactory((id, caps) ->233 new Session(234 id,235 nodeUri,236 new ImmutableCapabilities(),237 caps,238 Instant.now())239 );240 LocalNode localNode = LocalNode.builder(tracer, events, nodeUri, nodeUri, registrationSecret)241 .add(capabilities, sessionFactory).build();...

Full Screen

Full Screen

Source:DefaultSlotSelectorTest.java Github

copy

Full Screen

...52import java.util.stream.IntStream;53import java.util.stream.Stream;54import static org.assertj.core.api.Assertions.assertThat;55import static org.openqa.selenium.grid.data.Availability.UP;56public class DefaultSlotSelectorTest {57 private Tracer tracer;58 private EventBus bus;59 private URI uri;60 private Random random = new Random();61 @Before62 public void setUp() throws URISyntaxException {63 tracer = DefaultTestTracer.createTracer();64 bus = new GuavaEventBus();65 uri = new URI("http://localhost:1234");66 }67 @Test68 public void testGetPrioritizedNodeBuckets() {69 //build a bunch of nodes, using real values70 Set<NodeStatus> nodes = new HashSet<>();71 //Create 1 node that has edge, chrome, and firefox72 nodes.add(createNode("edge", "firefox", "chrome"));73 //Create 5 nodes that only have Chrome and Firefox74 IntStream.range(0, 4).forEach(ignore -> nodes.add(createNode("chrome", "firefox")));75 DefaultSlotSelector selector = new DefaultSlotSelector();76 //When you prioritize for Edge, you should only have 1 possibility77 Stream<NodeStatus> edgeNodes = nodes.stream()78 .filter(host -> host.hasCapacity(new ImmutableCapabilities("browserName", "edge")));79 Stream<NodeStatus> edgeStream = selector.getPrioritizedNodeStream(edgeNodes, new ImmutableCapabilities("browserName", "edge"))80 .filter(host -> host.hasCapacity(new ImmutableCapabilities("browserName", "edge")));81 assertThat(edgeStream.count()).isEqualTo(1);82 //When you prioritize for Chrome or Firefox, the Edge node will be removed, leaving 483 Stream<NodeStatus> chromeNodes = nodes.stream()84 .filter(host -> host.hasCapacity(new ImmutableCapabilities("browserName", "chrome")));85 Stream<NodeStatus> chromeStream = selector.getPrioritizedNodeStream(chromeNodes, new ImmutableCapabilities("browserName", "chrome"))86 .filter(host -> host.hasCapacity(new ImmutableCapabilities("browserName", "chrome")));87 assertThat(chromeStream.count()).isEqualTo(4);88 Stream<NodeStatus> firefoxNodes = nodes.stream()89 .filter(host -> host.hasCapacity(new ImmutableCapabilities("browserName", "firefox")));90 Stream<NodeStatus> firefoxStream = selector.getPrioritizedNodeStream(firefoxNodes, new ImmutableCapabilities("browserName", "firefox"))91 .filter(host -> host.hasCapacity(new ImmutableCapabilities("browserName", "firefox")));92 assertThat(firefoxStream.count()).isEqualTo(4);93 }94 @Test95 public void testAllBucketsSameSize() {96 Map<String, Set<NodeStatus>> buckets = buildBuckets(5, 5, 5, 5, 5, 5, 5, 5, 5, 5);97 DefaultSlotSelector selector = new DefaultSlotSelector();98 assertThat(selector.allBucketsSameSize(buckets)).isTrue();99 }100 @Test101 public void testAllBucketsNotSameSize() {102 Map<String, Set<NodeStatus>> buckets = buildBuckets(3, 5, 8 );103 DefaultSlotSelector selector = new DefaultSlotSelector();104 assertThat(selector.allBucketsSameSize(buckets)).isFalse();105 }106 @Test107 public void testOneBucketStillConsideredSameSize() {108 Map<String, Set<NodeStatus>> buckets = buildBuckets(3 );109 DefaultSlotSelector selector = new DefaultSlotSelector();110 assertThat(selector.allBucketsSameSize(buckets)).isTrue();111 }112 @Test113 public void testAllBucketsNotSameSizeProveNotUsingAverage() {114 //Make sure the numbers don't just average out to the same size115 Map<String, Set<NodeStatus>> buckets = buildBuckets(4, 5, 6 );116 DefaultSlotSelector selector = new DefaultSlotSelector();117 assertThat(selector.allBucketsSameSize(buckets)).isFalse();118 }119 @Test120 public void theMostLightlyLoadedNodeIsSelectedFirst() {121 // Create enough hosts so that we avoid the scheduler returning hosts in:122 // * insertion order123 // * reverse insertion order124 // * sorted with most heavily used first125 Capabilities caps = new ImmutableCapabilities("cheese", "beyaz peynir");126 NodeStatus lightest = createNode(caps, 10, 0);127 NodeStatus medium = createNode(caps, 10, 4);128 NodeStatus heavy = createNode(caps, 10, 6);129 NodeStatus massive = createNode(caps, 10, 8);130 SlotSelector selector = new DefaultSlotSelector();131 Set<SlotId> ids = selector.selectSlot(caps, ImmutableSet.of(heavy, medium, lightest, massive));132 SlotId expected = ids.iterator().next();133 assertThat(lightest.getSlots().stream()).anyMatch(slot -> expected.equals(slot.getId()));134 }135 private NodeStatus createNode(Capabilities stereotype, int count, int currentLoad) {136 NodeId nodeId = new NodeId(UUID.randomUUID());137 URI uri = createUri();138 Set<Slot> slots = new HashSet<>();139 for (int i = 0; i < currentLoad; i++) {140 Instant now = Instant.now();141 slots.add(142 new Slot(143 new SlotId(nodeId, UUID.randomUUID()),144 stereotype,...

Full Screen

Full Screen

Source:RouterTest.java Github

copy

Full Screen

...25import org.openqa.selenium.grid.data.DefaultSlotMatcher;26import org.openqa.selenium.grid.data.Session;27import org.openqa.selenium.grid.distributor.Distributor;28import org.openqa.selenium.grid.distributor.local.LocalDistributor;29import org.openqa.selenium.grid.distributor.selector.DefaultSlotSelector;30import org.openqa.selenium.grid.node.HealthCheck;31import org.openqa.selenium.grid.node.Node;32import org.openqa.selenium.grid.node.local.LocalNode;33import org.openqa.selenium.grid.security.Secret;34import org.openqa.selenium.grid.sessionmap.SessionMap;35import org.openqa.selenium.grid.sessionmap.local.LocalSessionMap;36import org.openqa.selenium.grid.sessionqueue.NewSessionQueue;37import org.openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue;38import org.openqa.selenium.grid.testing.PassthroughHttpClient;39import org.openqa.selenium.grid.testing.TestSessionFactory;40import org.openqa.selenium.grid.web.CombinedHandler;41import org.openqa.selenium.grid.web.Values;42import org.openqa.selenium.remote.http.HttpClient;43import org.openqa.selenium.remote.http.HttpRequest;44import org.openqa.selenium.remote.http.HttpResponse;45import org.openqa.selenium.remote.tracing.DefaultTestTracer;46import org.openqa.selenium.remote.tracing.Tracer;47import org.openqa.selenium.support.ui.FluentWait;48import java.net.URI;49import java.net.URISyntaxException;50import java.time.Duration;51import java.time.Instant;52import java.util.Map;53import java.util.concurrent.atomic.AtomicReference;54import static org.junit.Assert.assertFalse;55import static org.junit.Assert.assertNotNull;56import static org.openqa.selenium.grid.data.Availability.DOWN;57import static org.openqa.selenium.grid.data.Availability.UP;58import static org.openqa.selenium.json.Json.MAP_TYPE;59import static org.openqa.selenium.remote.http.HttpMethod.GET;60public class RouterTest {61 private Tracer tracer;62 private EventBus bus;63 private CombinedHandler handler;64 private SessionMap sessions;65 private NewSessionQueue queue;66 private Distributor distributor;67 private Router router;68 private Secret registrationSecret;69 @Before70 public void setUp() {71 tracer = DefaultTestTracer.createTracer();72 bus = new GuavaEventBus();73 handler = new CombinedHandler();74 HttpClient.Factory clientFactory = new PassthroughHttpClient.Factory(handler);75 sessions = new LocalSessionMap(tracer, bus);76 handler.addHandler(sessions);77 registrationSecret = new Secret("stinking bishop");78 queue = new LocalNewSessionQueue(79 tracer,80 bus,81 new DefaultSlotMatcher(),82 Duration.ofSeconds(2),83 Duration.ofSeconds(2),84 registrationSecret);85 handler.addHandler(queue);86 distributor = new LocalDistributor(87 tracer,88 bus,89 clientFactory,90 sessions,91 queue,92 new DefaultSlotSelector(),93 registrationSecret,94 Duration.ofMinutes(5),95 false);96 handler.addHandler(distributor);97 router = new Router(tracer, clientFactory, sessions, queue, distributor);98 }99 @Test100 public void shouldListAnEmptyDistributorAsMeaningTheGridIsNotReady() {101 Map<String, Object> status = getStatus(router);102 assertFalse((Boolean) status.get("ready"));103 }104 @Test105 public void addingANodeThatIsDownMeansTheGridIsNotReady() throws URISyntaxException {106 Capabilities capabilities = new ImmutableCapabilities("cheese", "peas");...

Full Screen

Full Screen

Source:DistributorOptions.java Github

copy

Full Screen

...30 static final String DEFAULT_DISTRIBUTOR_IMPLEMENTATION =31 "org.openqa.selenium.grid.distributor.local.LocalDistributor";32 static final String DEFAULT_SLOT_MATCHER = "org.openqa.selenium.grid.data.DefaultSlotMatcher";33 static final String DEFAULT_SLOT_SELECTOR_IMPLEMENTATION =34 "org.openqa.selenium.grid.distributor.selector.DefaultSlotSelector";35 static final boolean DEFAULT_REJECT_UNSUPPORTED_CAPS = false;36 private final Config config;37 public DistributorOptions(Config config) {38 this.config = config;39 }40 public URI getDistributorUri() {41 Optional<URI> host = config.get(DISTRIBUTOR_SECTION, "host").map(str -> {42 try {43 URI distributorUri = new URI(str);44 if (distributorUri.getHost() == null || distributorUri.getPort() == -1) {45 throw new ConfigException("Undefined host or port in Distributor server URI: " + str);46 }47 return distributorUri;48 } catch (URISyntaxException e) {...

Full Screen

Full Screen

Source:DefaultSlotSelector.java Github

copy

Full Screen

...23import org.openqa.selenium.grid.data.SlotId;24import java.util.Comparator;25import java.util.Set;26import static com.google.common.collect.ImmutableSet.toImmutableSet;27public class DefaultSlotSelector implements SlotSelector {28 @Override29 public Set<SlotId> selectSlot(Capabilities capabilities, Set<NodeStatus> nodes) {30 // First, filter the Nodes that support the required capabilities. Then, the filtered Nodes31 // get ordered in ascendant order by the number of browsers they support.32 // With this, Nodes with diverse configurations (supporting many browsers, e.g. Chrome,33 // Firefox, Safari) are placed at the bottom so they have more availability when a session34 // requests a browser supported only by a few Nodes (e.g. Safari only supported on macOS35 // Nodes).36 // After that, Nodes are ordered by their load, last session creation, and their id.37 return nodes.stream()38 .filter(node -> node.hasCapacity(capabilities))39 .sorted(40 Comparator.comparingLong(this::getNumberOfSupportedBrowsers)41 // Now sort by node which has the lowest load (natural ordering)42 .thenComparingDouble(NodeStatus::getLoad)43 // Then last session created (oldest first), so natural ordering again44 .thenComparingLong(NodeStatus::getLastSessionCreated)45 // And use the node id as a tie-breaker.46 .thenComparing(NodeStatus::getId))47 .flatMap(node -> node.getSlots().stream()48 .filter(slot -> !slot.getSession().isPresent())49 .filter(slot -> slot.isSupporting(capabilities))50 .map(Slot::getId))51 .collect(toImmutableSet());52 }53 @VisibleForTesting54 long getNumberOfSupportedBrowsers(NodeStatus nodeStatus) {55 return nodeStatus.getSlots()56 .stream()57 .map(slot -> slot.getStereotype().getBrowserName().toLowerCase())58 .distinct()59 .count();60 }61 public static SlotSelector create(Config config) {62 return new DefaultSlotSelector();63 }64}...

Full Screen

Full Screen

Source:GridModelTest.java Github

copy

Full Screen

...19import org.openqa.selenium.events.EventBus;20import org.openqa.selenium.events.local.GuavaEventBus;21import org.openqa.selenium.grid.data.DefaultSlotMatcher;22import org.openqa.selenium.grid.distributor.Distributor;23import org.openqa.selenium.grid.distributor.selector.DefaultSlotSelector;24import org.openqa.selenium.grid.security.Secret;25import org.openqa.selenium.grid.sessionmap.SessionMap;26import org.openqa.selenium.grid.sessionmap.local.LocalSessionMap;27import org.openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue;28import org.openqa.selenium.remote.http.HttpClient;29import org.openqa.selenium.remote.tracing.DefaultTestTracer;30import org.openqa.selenium.remote.tracing.Tracer;31import java.time.Duration;32public class GridModelTest {33 private final Tracer tracer = DefaultTestTracer.createTracer();34 private final EventBus events = new GuavaEventBus();35 private final HttpClient.Factory clientFactory = HttpClient.Factory.createDefault();36 private final SessionMap sessions = new LocalSessionMap(tracer, events);37 private final Secret secret = new Secret("cheese");38 LocalNewSessionQueue queue = new LocalNewSessionQueue(39 tracer,40 events,41 new DefaultSlotMatcher(),42 Duration.ofSeconds(2),43 Duration.ofSeconds(2),44 secret);45 private final Distributor distributor = new LocalDistributor(46 tracer,47 events,48 clientFactory,49 sessions,50 queue,51 new DefaultSlotSelector(),52 secret,53 Duration.ofMinutes(5),54 false);55 @Test56 public void shouldNotChangeTheStateOfANodeMarkedAsDownWhenNodeStatusEventFires() {57 }58}...

Full Screen

Full Screen

DefaultSlotSelector

Using AI Code Generation

copy

Full Screen

1import org.openqa.selenium.grid.distributor.selector.DefaultSlotSelector;2import org.openqa.selenium.grid.distributor.selector.SlotSelector;3import org.openqa.selenium.grid.distributor.selector.SlotSelectorOptions;4import org.openqa.selenium.grid.node.remote.RemoteNode;5import org.openqa.selenium.remote.http.HttpClient;6import org.openqa.selenium.remote.tracing.Tracer;7public class CustomSlotSelector implements SlotSelector {8 private final HttpClient.Factory clientFactory;9 private final Tracer tracer;10 public CustomSlotSelector(HttpClient.Factory clientFactory, Tracer tracer) {11 this.clientFactory = clientFactory;12 this.tracer = tracer;13 }14 public Optional<RemoteNode> selectSlot(15 SlotSelectorOptions options) {16 return Optional.empty();17 }18}19import org.openqa.selenium.grid.config.Config;20import org.openqa.selenium.grid.config.MemoizedConfig;21import org.openqa.selenium.grid.distributor.Distributor;22import org.openqa.selenium.grid.distributor.DistributorOptions;23import org.openqa.selenium.grid.distributor.selector.SlotSelector;24import org.openqa.selenium.grid.distributor.selector.SlotSelectorOptions;25import org.openqa.selenium.grid.node.remote.RemoteNode;26import org.openqa.selenium.remote.http.HttpClient;27import org.openqa.selenium.remote.tracing.Tracer;28public class CustomDistributor extends Distributor {29 private final HttpClient.Factory clientFactory;30 private final Tracer tracer;31 public CustomDistributor(32 SlotSelector selector) {33 super(options, selector);34 this.clientFactory = clientFactory;35 this.tracer = tracer;36 }37 public Optional<RemoteNode> selectSlot(38 SlotSelectorOptions options) {39 return Optional.empty();40 }41}42import org.openqa.selenium.grid.config.Config;43import org.openqa.selenium.grid.config.MemoizedConfig;44import org.openqa.selenium.grid.distributor.Distributor;45import org.openqa.selenium.grid.distributor.DistributorOptions;46import org.openqa.selenium.grid.distributor.selector.SlotSelector;47import org.openqa.selenium.grid.distributor.selector.SlotSelectorOptions;48import org.openqa.selenium.grid.node.remote.RemoteNode;49import org.openqa.selenium.remote.http.HttpClient;50import org.openqa.selenium.remote.tracing.Tracer;

Full Screen

Full Screen

DefaultSlotSelector

Using AI Code Generation

copy

Full Screen

1import org.openqa.selenium.grid.distributor.selector.DefaultSlotSelector;2import org.openqa.selenium.grid.distributor.selector.SlotSelector;3import org.openqa.selenium.grid.distributor.selector.SlotSelectorSupplier;4import org.openqa.selenium.grid.distributor.selector.SlotSelectors;5import org.openqa.selenium.grid.node.local.LocalNode;6import org.openqa.selenium.grid.node.local.LocalNodeFactory;7import org.openqa.selenium.grid.server.BaseServerOptions;8import org.openqa.selenium.grid.server.Server;9import org.openqa.selenium.grid.server.ServerFlags;10import org.openqa.selenium.grid.sessionmap.config.SessionMapOptions;11import org.openqa.selenium.grid.sessionmap.remote.RemoteSessionMap;12import org.openqa.selenium.grid.web.Routable;13import org.openqa.selenium.grid.web.Routes;14import org.openqa.selenium.internal.Require;15import org.openqa.selenium.remote.http.HttpClient;16import org.openqa.selenium.remote.tracing.Tracer;17import org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer;18import java.net.URI;19import java.util.Collections;20import java.util.Map;21import java.util.Objects;22import java.util.Optional;23import java.util.ServiceLoader;24import java.util.function.Supplier;25import java.util.logging.Logger;26public class Distributor implements Routable {27 private static final Logger LOG = Logger.getLogger(Distributor.class.getName());28 private final Server server;29 private final Supplier<SlotSelector> selector;30 public Distributor(31 Map<String, String> capabilities) {32 Require.nonNull("Tracer", tracer);33 Require.nonNull("HTTP client factory", clientFactory);34 Require.nonNull("Server options", serverOptions);35 Require.nonNull("Session map options", sessionMapOptions);36 RemoteSessionMap sessions = new RemoteSessionMap(tracer, clientFactory, sessionMapUri);37 SlotSelectorSupplier selectorSupplier = new SlotSelectorSupplier() {38 public SlotSelector get() {39 return new DefaultSlotSelector();40 }41 };42 ServerFlags serverFlags = new ServerFlags(serverOptions);43 Routes routes = new Routes();44 routes.add(new DistributorRoutes(tracer, sessions, selectorSupplier, capabilities));45 this.server = serverFlags.getServer(routes);46 selector = SlotSelectors.create(selectorSupplier, server);47 }

Full Screen

Full Screen

DefaultSlotSelector

Using AI Code Generation

copy

Full Screen

1DefaultSlotSelector slotSelector = new DefaultSlotSelector();2DefaultSlotMatcher slotMatcher = new DefaultSlotMatcher();3DefaultDistributor distributor = new DefaultDistributor(slotSelector, slotMatcher);4DistributorFactory factory = new DistributorFactory();5Distributor distributor = factory.createDistributor(config);6Distributor distributor = new Distributor(config);7DistributorOptions options = new DistributorOptions(config);8Distributor distributor = new Distributor(options.getSlotSelector(), options.getSlotMatcher());9DistributorConfig config = new DistributorConfig();10DistributorOptions options = new DistributorOptions(config);11Distributor distributor = new Distributor(options.getSlotSelector(), options.getSlotMatcher());12Distributor distributor = new Distributor(config);13DistributorOptions options = new DistributorOptions(config);14Distributor distributor = new Distributor(options.getSlotSelector(), options.getSlotMatcher());15DistributorConfig config = new DistributorConfig();16DistributorOptions options = new DistributorOptions(config);17Distributor distributor = new Distributor(options.getSlotSelector(), options.getSlotMatcher());18Distributor distributor = new Distributor(config);19DistributorOptions options = new DistributorOptions(config);20Distributor distributor = new Distributor(options.getSlotSelector(), options.getSlotMatcher());21DistributorConfig config = new DistributorConfig();22DistributorOptions options = new DistributorOptions(config);23Distributor distributor = new Distributor(options.getSlotSelector(), options.getSlotMatcher());

Full Screen

Full Screen

DefaultSlotSelector

Using AI Code Generation

copy

Full Screen

1import org.openqa.selenium.grid.distributor.selector.DefaultSlotSelector;2import org.openqa.selenium.grid.distributor.selector.SlotSelector;3import org.openqa.selenium.grid.distributor.selector.SlotSelectors;4import org.openqa.selenium.grid.distributor.selector.SlotSelectors;5import org.openqa.selenium.grid.node.remote.RemoteNode;6import org.openqa.selenium.grid.node.remote.RemoteNodeFactory;7import org.openqa.selenium.grid.sessionmap.config.SessionMapOptions;8import org.openqa.selenium.grid.sessionmap.config.SessionMapOptions;9import org.openqa.selenium.grid.sessionmap.remote.RemoteSessionMap;10import org.openqa.selenium.grid.sessionmap.remote.RemoteSessionMapFactory;11import org.openqa.selenium.grid.sessionmap.remote.RemoteSessionMapFactory;12import org.openqa.selenium.grid.web.Routable;13import org.openqa.selenium.grid.web.Routes;14import org.openqa.selenium.grid.web.Routes;15import org.openqa.selenium.net.UrlChecker;16import org.openqa.selenium.net.Urls;17import org.openqa.selenium.remote.http.HttpClient;18import org.openqa.selenium.remote.http.HttpClient;19import org.openqa.selenium.remote.tracing.Tracer;20import org.openqa.selenium.remote.tracing.Tracer;21import org.openqa.selenium.remote.tracing.Tracer;22import java.net.URI;23import java.net.URISyntaxException;24import java.time.Duration;25import java.util.Objects;26import java.util.Optional;27import java.util.logging.Logger;28public class DistributorFactory implements Routable {29 private static final Logger LOG = Logger.getLogger(DistributorFactory.class.getName());30 private final HttpClient.Factory clientFactory;31 private final Tracer tracer;32 private final SessionMapOptions sessionMapOptions;33 private final SlotSelectors slotSelectors;34 public DistributorFactory(35 SlotSelectors slotSelectors) {36 this.clientFactory = Objects.requireNonNull(clientFactory);37 this.tracer = Objects.requireNonNull(tracer);38 this.sessionMapOptions = Objects.requireNonNull(sessionMapOptions);39 this.slotSelectors = Objects.requireNonNull(slotSelectors);40 }41 public void configure(Routes routes) {42 routes.get("/status", new StatusHandler());43 routes.get("/sessions", new ListSessionsHandler(tracer, sessionMapOptions));44 routes.post("/se/grid/distributor/session", new NewSessionHandler(tracer, sessionMapOptions));45 routes.get("/se/grid/distributor/session/{sessionId}", new GetSessionHandler(tracer, sessionMapOptions));46 routes.delete("/se/grid/distributor/session/{sessionId}", new DeleteSessionHandler(tracer, sessionMapOptions));47 }

Full Screen

Full Screen

DefaultSlotSelector

Using AI Code Generation

copy

Full Screen

1import org.openqa.selenium.grid.distributor.selector.DefaultSlotSelector;2import org.openqa.selenium.grid.distributor.selector.SlotSelector;3import org.openqa.selenium.grid.distributor.selector.SlotSelectorOptions;4import org.openqa.selenium.grid.sessionmap.config.SessionMapOptions;5import org.openqa.selenium.grid.web.Routable;6import org.openqa.selenium.grid.web.Routes;7import org.openqa.selenium.remote.tracing.Tracer;8import org.openqa.selenium.remote.tracing.config.distributed.DistributedTracerOptions;9import org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryOptions;10import org.openqa.selenium.remote.tracing.opentelemetry.config.OpenTelemetryConfig;11import java.util.Objects;12import java.util.ServiceLoader;13import java.util.function.Supplier;14public class SlotSelectorFactory {15 public static SlotSelector createSlotSelector(Tracer tracer, SlotSelectorOptions slotSelectorOptions) {16 Objects.requireNonNull(tracer, "Tracer must be set.");17 Objects.requireNonNull(slotSelectorOptions, "SlotSelectorOptions must be set.");18 SlotSelector slotSelector = ServiceLoader.load(SlotSelector.class)19 .stream()20 .map(ServiceLoader.Provider::get)21 .filter(slotSelector1 -> slotSelector1.getName().equals(slotSelectorOptions.getName()))22 .findFirst()23 .orElseThrow(() -> new IllegalArgumentException(24 String.format("Unable to find slot selector with name: %s", slotSelectorOptions.getName())));25 return slotSelector;26 }27}

Full Screen

Full Screen

DefaultSlotSelector

Using AI Code Generation

copy

Full Screen

1import org.openqa.selenium.grid.config.Config;2import org.openqa.selenium.grid.config.ConfigException;3import org.openqa.selenium.grid.config.MemoizedConfig;4import org.openqa.selenium.grid.distributor.selector.DefaultSlotSelectorFactory;5import org.openqa.selenium.grid.distributor.selector.SlotSelector;6import org.openqa.selenium.grid.distributor.selector.SlotSelectorFactory;7import org.openqa.selenium.grid.node.Node;8import org.openqa.selenium.grid.node.local.LocalNode;9import org.openqa.selenium.grid.server.BaseServerOptions;10import org.openqa.selenium.grid.server.Server;11import org.openqa.selenium.grid.server.ServerFlags;12import org.openqa.selenium.grid.server.ServerSecrets;13import org.openqa.selenium.grid.web.Values;14import org.openqa.selenium.internal.Require;15import org.openqa.selenium.json.Json;16import org.openqa.selenium.remote.tracing.Tracer;17import org.openqa.selenium.remote.tracing.config.ConfigValue;18import org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracer;19import org.openqa.selenium.remote.tracing.opentelemetry.OpenTelemetryTracerFactory;20import org.openqa.selenium.remote.tracing.opentelemetry.config.OpenTelemetryConfig;21import org.openqa.selenium.remote.tracing.opentelemetry.config.OpenTelemetryConfigValue;22import org.openqa.selenium.remote.tracing.opentelemetry.exporter.OpenTelemetryExporter;23import org.openqa.selenium.remote.tracing.opentelemetry.exporter.zipkin.ZipkinExporter;24import org.openqa.selenium.remote.tracing.opentelemetry.exporter.zipkin.ZipkinExporterFactory;25import org.openqa.selenium.remote.tracing.opentelemetry.exporter.zipkin.config.ZipkinExporterConfig;26import org.openqa.selenium.remote.tracing.opentelemetry.exporter.zipkin.config.ZipkinExporterConfigValue;27import org.openqa.selenium.remote.tracing.opentelemetry.logging.LoggingExporter;28import org.openqa.selenium.remote.tracing.opentelemetry.logging.LoggingExporterFactory;29import org.openqa.selenium.remote.tracing.opentelemetry.logging.config.LoggingExporterConfig;30import org.openqa.selenium.remote.tracing.opentelemetry.logging.config.LoggingExporterConfigValue;31import org.openqa.selenium.remote.tracing.opentelemetry.propagation.Propagators;32import org.openqa.selenium.remote.tracing.opentelemetry.propagation.PropagatorsFactory;33import org.openqa.selenium.remote.tracing.opentelemetry.propagation.config.PropagatorsConfig;34import org.openqa.selenium.remote.tracing.opentelemetry.propagation.config.PropagatorsConfigValue;35import org.openqa

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.

Most used methods in DefaultSlotSelector

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