Selenium::Chrome(3)

πŸ“¦ version 1.49, in opensuse-leap 16.0

πŸ’… Selenium::Chrome(3) β€” the perl doc bestie edition πŸŽ€

okay so this is the Selenium::Chrome(3) page from the User Contributed Perl Documentation, and it's genuinely one of my faves β€” it's all about driving Chrome without dragging a whole Selenium server along. let's get into it ✨


🌸 NAME 🌸

Selenium::Chrome β€” use ChromeDriver without a Selenium server. no cap, that's the whole vibe. πŸ¦‹


⭐ VERSION ⭐

version 1.49 πŸ’–


✨ SYNOPSIS ✨

my $driver = Selenium::Chrome->new;
# when you're done
$driver->shutdown_binary;

like, that's it. that's the whole relationship. 🌈


πŸ’œ DESCRIPTION πŸ’œ

So this class lets you use the ChromeDriver without needing the JRE or a selenium server running. huge. iconic. no extra server main character energy required. πŸ‘‘

When you refrain from passing the remote_server_addr and port arguments, we will search for the chromedriver executable binary in your $PATH. We'll try to start the binary, connect to it, and shut it down at the end of the test. it's giving self-sufficient. 🫢

If the chromedriver binary is not found, we'll fall back to the default Selenium::Remote::Driver behavior of assuming defaults of 127.0.0.1:4444 after waiting a few seconds. (yes, a few seconds of waiting. we're being patient. we're being chill. 😌)

If you specify a remote server address, or a port, we'll assume you know what you're doing and take no additional behavior. respect. 🫑

If you're curious whether your Selenium::Chrome instance is using a separate ChromeDriver binary, or through the selenium server, you can check the binary_mode attr after instantiation. vibe check your driver, bestie. πŸ”


πŸŽ€ ATTRIBUTES πŸŽ€

🌸 binary

Optional: specify the path to your binary. If you don't specify anything, we'll try to find it on our own via which in File::Which. we're resourceful like that. ✨

πŸ¦‹ binary_port

Optional: specify the port that we should bind to. If you don't specify anything, we'll default to the driver's default port.

⚠️ okay important: since there's no a priori guarantee that this will be an open port, this is _not_ necessarily the port that we end up using β€” if the port here is already bound, we'll search above it until we find an open one. so like, don't @ us if the number changes. πŸ’€

See "port" in Selenium::CanStartBinary for more details, and "port" in Selenium::Remote::Driver after instantiation to see what the actual port turned out to be. the truth is in there. πŸ”₯

πŸ“ custom_args

Optional: specify any additional command line arguments you'd like invoked during the binary startup. See "custom_args" in Selenium::CanStartBinary for more information. go off, customize your launch. πŸ’…

🧚 startup_timeout

Optional: specify how long to wait for the binary to start itself and listen on its port. The default duration is arbitrarily 10 seconds. It accepts an integer number of seconds to wait β€” the following will wait up to 20 seconds:

Selenium::Chrome->new( startup_timeout => 20 );

See "startup_timeout" in Selenium::CanStartBinary for more information. patience is a virtue fr fr. ⏳

πŸ‘‘ fixed_ports

Optional: Throw instead of searching for additional ports; see "fixed_ports" in Selenium::CanStartBinary for more info. sometimes you just want it to commit, y'know? 🎯


πŸ”₯ METHODS πŸ”₯

πŸ’– shutdown_binary

Call this method instead of "quit" in Selenium::Remote::Driver to ensure that the binary executable is also closed, instead of simply closing the browser itself. If the browser is still around, it will call "quit" for you. After that, it will try to shutdown the browser binary by making a GET to /shutdown and on Windows, it will attempt to do a "taskkill" on the binary CMD window. 😭 thorough.

$self->shutdown_binary;

It doesn't take any arguments, and it doesn't return anything. zero drama, zero returns. πŸ™ˆ

We do our best to call this when the $driver option goes out of scope, but if that happens during global destruction, there's nothing we can do. πŸ’€ not our fault, the universe is ending. literally.

🌈 AUTHORS 🌈

Current Maintainers:

  • George S. Baugh <george@troglodyne.net>

Previous maintainers:

  • Daniel Gempesaw <gempesaw@gmail.com>
  • Emmanuel PeroumalnaΓ―k <peroumalnaik.emmanuel@gmail.com>
  • Luke Closs <cpan@5thplane.com>
  • Mark Stosberg <mark@stosberg.com>

Original authors:

  • Aditya Ivaturi <ivaturi@gmail.com>

legends, all of them. 🫢✨


Copyright (c) 2010-2011 Aditya Ivaturi, Gordon Child

Copyright (c) 2014-2017 Daniel Gempesaw

Copyright (c) 2018-2021 George S. Baugh

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


and that's the page!! this beauty is perl v5.42.0, dated 2023-04-07, and it's Selenium::Chrome(3) β€” go forth and drive Chrome, bestie, you've got this πŸ’…πŸ’–πŸŽ€