### Run Example Test with Nosetests (Headless) Source: https://seleniumbase.io/integrations/google_cloud/ReadMe Verify installation by running the example test using nosetests in headless mode. ```bash nosetests examples/my_first_test.py --headless ``` -------------------------------- ### Example SeleniumBase Command Source: https://seleniumbase.io/ This example demonstrates how to use the 'sbase get' command to download a specific driver, such as chromedriver. ```bash sbase get chromedriver stable ``` -------------------------------- ### Example SeleniumBase Command Source: https://seleniumbase.io/w3schools/sbase This is an example of how to use the `sbase get` command to download a specific version of a webdriver. Refer to the CLI overview for more command examples. ```bash sbase get chromedriver stable ``` -------------------------------- ### Start local Selenium Grid Node Source: https://seleniumbase.io/help_docs/desired_capabilities Command to start a local Selenium Grid Node. Requires Java to be installed. ```bash sbase grid-node start ``` -------------------------------- ### Install SeleniumBase Source: https://seleniumbase.io/integrations/google_cloud/ReadMe Install SeleniumBase in development mode using the setup.py script. ```bash sudo python setup.py develop ``` -------------------------------- ### Run Google Tour Example Source: https://seleniumbase.io/examples/tour_examples/ReadMe Execute the Google tour example from the command line. This demonstrates a more comprehensive tour. ```bash cd examples/tour_examples pytest google_tour.py ``` -------------------------------- ### Cloning SeleniumBase and Running Examples Source: https://seleniumbase.io/examples/master_qa/ReadMe Provides instructions on how to clone the SeleniumBase repository, install the library, and run the MasterQA example tests using pytest. ```bash git clone https://github.com/seleniumbase/SeleniumBase.git cd SeleniumBase pip install . cd examples/master_qa pytest basic_masterqa_test_0.py pytest masterqa_test_1.py ``` -------------------------------- ### Run Tour Example Source: https://seleniumbase.io/help_docs/js_package_manager Navigate to the tour examples directory and run the maps tour with a 1-second interval for automatic progression. ```bash cd examples/tour_examples pytest maps_introjs_tour.py --interval=1 ``` -------------------------------- ### Download Web Drivers Source: https://seleniumbase.io/seleniumbase/console_scripts/ReadMe Use the `get` or `install` command to download specified web drivers. The driver version typically matches the browser version if not specified. The `-p` option copies the driver to `/usr/local/bin`. ```bash sbase get chromedriver ``` ```bash sbase get geckodriver ``` ```bash sbase get edgedriver ``` ```bash sbase get chromedriver 114 ``` ```bash sbase get chromedriver 114.0.5735.90 ``` ```bash sbase get chromedriver stable ``` ```bash sbase get chromedriver beta ``` ```bash sbase get chromedriver -p ``` ```bash sbase get chromium ``` ```bash sbase get cft 131 ``` ```bash sbase get chs ``` -------------------------------- ### Install Selenium with Pip Source: https://seleniumbase.io/other/fundamentals.html Use pip to install the Selenium library for Python. This is the first step to start automating web browsers. ```bash pip install selenium ``` -------------------------------- ### Install MySQL Server on Ubuntu Source: https://seleniumbase.io/help_docs/mysql_installation Installs the MySQL server package on Ubuntu. This command updates the package list and then installs the server. ```bash sudo apt update sudo apt install mysql-server ``` -------------------------------- ### Run IntroJS Tour Example Source: https://seleniumbase.io/examples/tour_examples/ReadMe Execute the IntroJS tour example from the command line. The --interval flag controls the autoplay speed. ```bash cd examples/tour_examples pytest maps_introjs_tour.py --interval=1 ``` -------------------------------- ### Install Python packages using pip Source: https://seleniumbase.io/other/py_virtual_envs.html Install packages from PyPI, local setup.py files (for normal or editable installs), or from a requirements.txt file within an activated virtual environment. ```bash # Install a package from PyPI: pip install seleniumbase # Install packages from a folder with setup.py: pip install . # Normal installation pip install -e . # Editable install # Install packages from a requirements.txt file: pip install -r requirements.txt ``` -------------------------------- ### Run Example Tests with GUI Test Runner Source: https://seleniumbase.io/examples/ReadMe Launch a simple GUI program to run example tests by pressing a button. ```bash python gui_test_runner.py ``` -------------------------------- ### Install SeleniumBase from PyPI Source: https://seleniumbase.io/ Use this command to install the latest version of SeleniumBase from the Python Package Index. Add --upgrade to update an existing installation. ```bash pip install seleniumbase ``` -------------------------------- ### Install SeleniumBase from GitHub Source: https://seleniumbase.io/devices?url=seleniumbase.io Clone the SeleniumBase repository from GitHub and install it in editable mode for development. Use 'git pull' and 'pip install -e .' to upgrade. ```bash git clone https://github.com/seleniumbase/SeleniumBase.git cd SeleniumBase/ pip install -e . ``` ```bash git pull pip install -e . ``` -------------------------------- ### Install SeleniumBase from PyPI Source: https://seleniumbase.io/help_docs/install Use this command to install the latest stable version of SeleniumBase from the Python Package Index. ```bash pip install seleniumbase ``` -------------------------------- ### Run Example Test with Pynose Source: https://seleniumbase.io/examples/ReadMe Execute a test file using pynose. ```bash pynose my_first_test.py ``` -------------------------------- ### Start local Selenium Grid Hub Source: https://seleniumbase.io/help_docs/desired_capabilities Command to start a local Selenium Grid Hub. The Selenium Server JAR will be downloaded automatically if not present. ```bash sbase grid-hub start ``` -------------------------------- ### Start MySQL Service on Ubuntu Source: https://seleniumbase.io/help_docs/mysql_installation Starts the MySQL service on an Ubuntu Linux system. This is a prerequisite for performing database operations. ```bash sudo /etc/init.d/mysql start ``` -------------------------------- ### Run Line Chart Example from test_line_chart.py Source: https://seleniumbase.io/examples/chart_maker/ReadMe Execute the line chart example from the 'examples/chart_maker' directory using pytest. ```bash pytest test_line_chart.py ``` -------------------------------- ### Run SeleniumBase Tests from Examples Folder Source: https://seleniumbase.io/ Navigate to the examples directory and run a specific test file using pytest. Ensure SeleniumBase is cloned to access this functionality. ```bash cd examples/ pytest my_first_test.py ``` -------------------------------- ### Run Example Test on Firefox (Headless) Source: https://seleniumbase.io/integrations/google_cloud/ReadMe Execute the example test using pytest in headless mode, specifying Firefox as the browser. ```bash pytest examples/my_first_test.py --headless --browser=firefox ``` -------------------------------- ### Install SeleniumBase from GitHub Clone Source: https://seleniumbase.io/help_docs/install Clone the SeleniumBase repository from GitHub and install it locally. This is useful for development or testing the latest unreleased code. ```bash git clone https://github.com/seleniumbase/SeleniumBase.git cd SeleniumBase/ pip install . ``` -------------------------------- ### Run Example Test in Headless Chrome Source: https://seleniumbase.io/integrations/azure/jenkins/ReadMe Execute a sample SeleniumBase test using pytest in headless mode with the Chrome browser. This verifies the installation and setup. ```bash pytest examples/my_first_test.py --headless --browser=chrome ``` -------------------------------- ### Install pip using get-pip.py Source: https://seleniumbase.io/help_docs/install_python_pip_git A reliable method to get or fix pip installation, especially useful if facing SSL errors during package installation. ```bash curl https://bootstrap.pypa.io/get-pip.py | python ``` -------------------------------- ### SeleniumBase Starting Page and Capabilities Source: https://seleniumbase.io/devices?url=seleniumbase.io Options for setting the initial URL and browser capabilities. ```bash --start-page=URL # (The starting URL for the web browser when tests begin.) ``` ```bash --cap-file=FILE # (The web browser's desired capabilities to use.) ``` ```bash --cap-string=STRING # (The web browser's desired capabilities to use.) ``` -------------------------------- ### Basic Selenium WebDriver Setup Source: https://seleniumbase.io/other/fundamentals.html Demonstrates the fundamental steps to initialize a Chrome WebDriver, navigate to a URL, find an element, interact with it, and close the browser. ```python from selenium import webdriver driver = webdriver.Chrome() driver.get("http://selenium.dev") element = driver.find_element("css selector", "#docsearch span") element.click() elem_2 = driver.find_element("css selector", "#docsearch-input") elem_2.send_keys("Python") driver.quit() ``` -------------------------------- ### Create SeleniumBase Presentation File (`mkpres`) Source: https://seleniumbase.io/seleniumbase/console_scripts/ReadMe Generates a new SeleniumBase presentation file with 3 example slides. Supports specifying the language for the slides. If the file already exists, an error is raised. ```bash sbase mkpres [FILE.py] [LANG] ``` ```bash sbase mkpres new_presentation.py --en ``` ```bash sbase mkpres new_presentation.py --zh ``` ```bash sbase mkpres new_presentation.py --nl ``` ```bash sbase mkpres new_presentation.py --fr ``` ```bash sbase mkpres new_presentation.py --it ``` ```bash sbase mkpres new_presentation.py --ja ``` ```bash sbase mkpres new_presentation.py --ko ``` ```bash sbase mkpres new_presentation.py --pt ``` ```bash sbase mkpres new_presentation.py --ru ``` ```bash sbase mkpres new_presentation.py --es ``` -------------------------------- ### Install SeleniumBase Package Source: https://seleniumbase.io/integrations/azure/jenkins/ReadMe Install the SeleniumBase package in development mode. This command should be run after all requirements have been installed. ```bash sudo python setup.py develop ``` -------------------------------- ### Ensure pip Installation Source: https://seleniumbase.io/help_docs/install_python_pip_git Use this command if your pip installation has issues. It ensures pip is installed by default. ```bash python -m ensurepip --default-pip ``` -------------------------------- ### Create Basic SeleniumBase Project Folder Source: https://seleniumbase.io/ Use `sbase mkdir --basic` to create a new project folder with minimal configuration files, excluding sample tests. This is useful for starting a project with only the essential configuration. ```bash sbase mkdir ui_tests --basic ``` -------------------------------- ### Install SeleniumBase and Playwright Source: https://seleniumbase.io/examples/cdp_mode/playwright/ReadMe Install the necessary Python packages for Stealthy Playwright Mode. No additional Playwright installation is required. ```bash pip install seleniumbase playwright ``` -------------------------------- ### Run Example Test with Pynose Configuration Source: https://seleniumbase.io/examples/ReadMe Execute a test file using pynose with a specified configuration file. ```bash pynose my_first_test.py --config=example_config.cfg ``` -------------------------------- ### Install virtualenvwrapper (Windows CMD) Source: https://seleniumbase.io/help_docs/virtualenv_instructions Installs the virtualenvwrapper package for Windows using pip. The --user flag installs it for the current user. ```batch py -m pip install virtualenvwrapper-win --force-reinstall --user ``` -------------------------------- ### Install SeleniumBase from a GitHub Branch Source: https://seleniumbase.io/help_docs/install Install SeleniumBase directly from a specific branch on GitHub using pip. This allows installation from branches other than the default. ```bash pip install git+https://github.com/seleniumbase/SeleniumBase.git@master#egg=seleniumbase ``` -------------------------------- ### Basic Login with Driver() Format Source: https://seleniumbase.io/help_docs/syntax_formats Perform a basic login sequence using the Driver() format. This example demonstrates typing credentials, clicking a sign-in button, and asserting successful login. It also shows how to log out. ```python from seleniumbase import Driver driver = Driver() try: driver.open("seleniumbase.io/simple/login") driver.type("#username", "demo_user") driver.type("#password", "secret_pass") driver.click('a:contains("Sign in")') driver.assert_exact_text("Welcome!", "h1") driver.assert_element("img#image1") driver.highlight("#image1") driver.click_link("Sign out") driver.assert_text("signed out", "#top_message") finally: driver.quit() ``` -------------------------------- ### Create New Recording from CLI Source: https://seleniumbase.io/help_docs/recorder_mode Use 'sbase mkrec' to start a new recording. Provide a test name and an optional URL. If no URL is given, recording starts on a blank page. The recording will be saved as 'TEST_NAME_rec.py' and copied to 'TEST_NAME.py'. Add '--edge' for Edge browser or '--gui' for headed mode on Linux. ```bash sbase mkrec TEST_NAME.py --url=URL ``` ```bash sbase mkrec new_test.py --url=wikipedia.org ``` -------------------------------- ### Use Chrome for Testing (CFT) Source: https://seleniumbase.io/help_docs/customizing_test_runs Download the Chrome for Testing binary using `sbase get cft`. Then, run tests with the `--cft` flag. ```bash sbase get cft ``` ```bash pytest --cft -n8 --dashboard --html=report.html -v --rs --headless ``` -------------------------------- ### Running MasterQA Tests Source: https://seleniumbase.io/seleniumbase/masterqa/ReadMe Instructions for setting up and running MasterQA tests from the command line. Includes cloning the repository, installing SeleniumBase, and executing test files. ```bash git clone https://github.com/seleniumbase/SeleniumBase.git cd SeleniumBase pip install . cd examples/master_qa pytest basic_masterqa_test_0.py pytest masterqa_test_1.py ``` -------------------------------- ### Install MySQL on macOS Source: https://seleniumbase.io/help_docs/mysql_installation Installs MySQL using the Homebrew package manager on macOS. ```bash brew install mysql ``` -------------------------------- ### Install Allure Pytest Plugin Source: https://seleniumbase.io/devices?url=seleniumbase.io Install the allure-pytest plugin to generate Allure results files for your tests. ```bash pip install allure-pytest ``` -------------------------------- ### Start Headless Browser Display Source: https://seleniumbase.io/integrations/google_cloud/ReadMe Launch Xvfb, a virtual framebuffer, to enable headless browser testing. ```bash ./Xvfb_launcher.sh ``` -------------------------------- ### Open Start Page in SeleniumBase Source: https://seleniumbase.io/help_docs/method_summary Use `self.open_start_page()` to navigate to the default start page configured for SeleniumBase. ```python self.open_start_page() ``` -------------------------------- ### Start Proxy Server Source: https://seleniumbase.io/seleniumbase/console_scripts/ReadMe Launch a basic proxy server using the `sbase proxy` command. This can be useful for intercepting or modifying network traffic during testing. ```bash sbase proxy ``` -------------------------------- ### Install allure-pytest Source: https://seleniumbase.io/ Install allure-pytest to generate Allure results files for Allure Reports. This is no longer included by default. ```bash pip install allure-pytest ``` -------------------------------- ### Run Line Chart Presentation Example Source: https://seleniumbase.io/examples/chart_maker/ReadMe Execute a Python script to generate and display a line chart presentation. Navigate to the 'examples/chart_maker' directory before running. ```bash cd examples/chart_maker pytest chart_presentation.py ``` -------------------------------- ### Install SeleniumBase Requirements Source: https://seleniumbase.io/integrations/google_cloud/ReadMe Install all required Python packages for SeleniumBase using pip, upgrading existing ones. ```bash sudo pip install -r requirements.txt --upgrade ``` -------------------------------- ### Install virtualenvwrapper (macOS/Linux) Source: https://seleniumbase.io/help_docs/virtualenv_instructions Installs the virtualenvwrapper package and sets up the necessary environment variables for its use on macOS or Linux. ```bash python3 -m pip install virtualenvwrapper --force-reinstall export WORKON_HOME=$HOME/.virtualenvs source `which virtualenvwrapper.sh` ``` -------------------------------- ### Create Presentation with Themes Source: https://seleniumbase.io/examples/presenter/ReadMe Demonstrates creating a presentation with various available themes. Use this when you need to customize the visual style of your presentation. ```python self.create_presentation(theme="serif") self.create_presentation(theme="sky") self.create_presentation(theme="simple") self.create_presentation(theme="white") self.create_presentation(theme="moon") self.create_presentation(theme="black") self.create_presentation(theme="night") self.create_presentation(theme="beige") self.create_presentation(theme="league") ``` -------------------------------- ### Download Selenium Grid Server Source: https://seleniumbase.io/seleniumbase/utilities/selenium_grid/ReadMe Use this command to download the necessary Selenium Grid server files. This is a prerequisite for setting up your own Selenium Grid. ```bash seleniumbase download server ``` -------------------------------- ### Verify SeleniumBase Installation Source: https://seleniumbase.io/ Run 'seleniumbase' or 'sbase' in your terminal to confirm a successful installation and view the command-line interface help. ```bash ___ _ _ ___ / __| ___| |___ _ _ (_)_ _ _ __ | _ ) __ _ ______ \__ \/ -_) / -_) ' \| | \|, | ' \ | _ \/ _` (_-< -_) |___/\___|_ ___|_||_|_|\_,_|_|_|_\___/\__,_/__|___| ---------------------------------------------------- ╭──────────────────────────────────────────────────╮ │ * USAGE: "seleniumbase [COMMAND] [PARAMETERS]" │ │ * OR: "sbase [COMMAND] [PARAMETERS]" │ │ │ │ COMMANDS: PARAMETERS / DESCRIPTIONS: │ │ get / install [DRIVER_NAME] [OPTIONS] │ │ methods (List common Python methods) │ │ options (List common pytest options) │ │ behave-options (List common behave options) │ │ gui / commander [OPTIONAL PATH or TEST FILE] │ │ behave-gui (SBase Commander for Behave) │ │ caseplans [OPTIONAL PATH or TEST FILE] │ │ mkdir [DIRECTORY] [OPTIONS] │ │ mkfile [FILE.py] [OPTIONS] │ │ mkrec / codegen [FILE.py] [OPTIONS] │ │ recorder (Open Recorder Desktop App.) │ │ record (If args: mkrec. Else: App.) │ │ mkpres [FILE.py] [LANG] │ │ mkchart [FILE.py] [LANG] │ │ print [FILE] [OPTIONS] │ │ translate [SB_FILE.py] [LANG] [ACTION] │ │ convert [WEBDRIVER_UNITTEST_FILE.py] │ │ extract-objects [SB_FILE.py] │ │ inject-objects [SB_FILE.py] [OPTIONS] │ │ objectify [SB_FILE.py] [OPTIONS] │ │ revert-objects [SB_FILE.py] [OPTIONS] │ │ encrypt / obfuscate │ │ decrypt / unobfuscate │ │ proxy (Start a basic proxy server) │ │ download server (Get Selenium Grid JAR file) │ │ grid-hub [start|stop] [OPTIONS] │ │ grid-node [start|stop] --hub=[HOST/IP] │ │ │ │ * EXAMPLE => "sbase get chromedriver stable" │ │ * For command info => "sbase help [COMMAND]" │ │ * For info on all commands => "sbase --help" │ ╰──────────────────────────────────────────────────╯ ``` -------------------------------- ### Create SeleniumBase Chart File (`mkchart`) Source: https://seleniumbase.io/seleniumbase/console_scripts/ReadMe Generates a new SeleniumBase chart presentation file. Supports specifying the language for the slides. If the file already exists, an error is raised. ```bash sbase mkchart [FILE.py] [LANG] ``` ```bash sbase mkchart new_chart.py --en ``` ```bash sbase mkchart new_chart.py --zh ``` ```bash sbase mkchart new_chart.py --nl ``` ```bash sbase mkchart new_chart.py --fr ``` ```bash sbase mkchart new_chart.py --it ``` ```bash sbase mkchart new_chart.py --ja ``` ```bash sbase mkchart new_chart.py --ko ``` ```bash sbase mkchart new_chart.py --pt ``` ```bash sbase mkchart new_chart.py --ru ``` ```bash sbase mkchart new_chart.py --es ``` -------------------------------- ### Install ChromeDriver Source: https://seleniumbase.io/integrations/azure/jenkins/ReadMe Install the ChromeDriver executable, which is required for running Selenium tests with Chrome. This command is part of the SeleniumBase toolset. ```bash sudo seleniumbase install chromedriver ``` -------------------------------- ### SeleniumBase Command-Line Interface Source: https://seleniumbase.io/devices?url=seleniumbase.io Verify the SeleniumBase installation by running 'seleniumbase' or 'sbase'. This displays available commands and their parameters. Use 'sbase help [COMMAND]' for specific command details. ```bash ___ _ _ ___ / __| ___| |___ _ _ (_)_ _ _ __ | _ ) __ _ ______ __ / -_) / -_) ' | | | | ' | _ / _` (_-< -_) |___/___|____|_||_|_|_,_|_|_|_|___/__,_/__|___| ---------------------------------------------------- ╭──────────────────────────────────────────────────╮ │ * USAGE: "seleniumbase [COMMAND] [PARAMETERS]" │ │ * OR: "sbase [COMMAND] [PARAMETERS]" │ │ │ │ COMMANDS: PARAMETERS / DESCRIPTIONS: │ │ get / install [DRIVER_NAME] [OPTIONS] │ │ methods (List common Python methods) │ options (List common pytest options) │ behave-options (List common behave options) │ gui / commander [OPTIONAL PATH or TEST FILE] │ behave-gui (SBase Commander for Behave) │ caseplans [OPTIONAL PATH or TEST FILE] │ mkdir [DIRECTORY] [OPTIONS] │ mkfile [FILE.py] [OPTIONS] │ mkrec / codegen [FILE.py] [OPTIONS] │ recorder (Open Recorder Desktop App.) │ record (If args: mkrec. Else: App.) │ mkpres [FILE.py] [LANG] │ mkchart [FILE.py] [LANG] │ print [FILE] [OPTIONS] │ translate [SB_FILE.py] [LANG] [ACTION] │ convert [WEBDRIVER_UNITTEST_FILE.py] │ extract-objects [SB_FILE.py] │ inject-objects [SB_FILE.py] [OPTIONS] │ objectify [SB_FILE.py] [OPTIONS] │ revert-objects [SB_FILE.py] [OPTIONS] │ encrypt / obfuscate │ decrypt / unobfuscate │ proxy (Start a basic proxy server) │ download server (Get Selenium Grid JAR file) │ grid-hub [start|stop] [OPTIONS] │ grid-node [start|stop] --hub=[HOST/IP] │ │ │ * EXAMPLE => "sbase get chromedriver stable" │ * For command info => "sbase help [COMMAND]" │ * For info on all commands => "sbase --help" ╰──────────────────────────────────────────────────╯ ``` -------------------------------- ### Verify Geckodriver (Firefox) Installation Source: https://seleniumbase.io/help_docs/verify_webdriver Verify that Geckodriver is installed and accessible. This code opens Firefox and navigates to a specific page. ```python >>> from seleniumbase import get_driver >>> driver = get_driver("firefox", headless=False) >>> driver.get("https://www.mozilla.org/firefox") >>> driver.quit() >>> exit() ``` -------------------------------- ### Verify ChromeDriver Installation Source: https://seleniumbase.io/help_docs/verify_webdriver Verify that ChromeDriver is installed and accessible. This code opens Google Chrome and navigates to a specific page. ```python >>> from seleniumbase import get_driver >>> driver = get_driver("chrome", headless=False) >>> driver.get("https://www.google.com/chrome") >>> driver.quit() >>> exit() ``` -------------------------------- ### Initialize Async CDP Driver Source: https://seleniumbase.io/help_docs/cdp_mode_methods Starts an asynchronous CDP driver. Use `await driver.get(url)` to navigate to a specific URL and obtain a tab object for further interaction. ```python from seleniumbase import cdp_driver driver = await cdp_driver.start_async() tab = await driver.get(url, **kwargs) ``` -------------------------------- ### Pure CDP Mode Method Examples Source: https://seleniumbase.io/examples/cdp_mode/ReadMe Illustrates various actions that can be performed using Pure CDP Mode, such as typing, clicking, selecting options, and GUI interactions. ```APIDOC ## Pure CDP Mode Method Examples ### Description Showcases a variety of methods available in Pure CDP Mode for interacting with web elements and performing GUI actions. ### Code ```python from seleniumbase import sb_cdp url = "https://seleniumbase.io/demo_page" sb = sb_cdp.Chrome(url) sb.press_keys("input", "Text") sb.highlight("button") sb.type("textarea", "Here are some words") sb.click("button") sb.set_value("input#mySlider", "100") sb.click_visible_elements("input.checkBoxClassB") sb.select_option_by_text("#mySelect", "Set to 75%") sb.gui_hover_and_click("#myDropdown", "#dropOption2") sb.gui_click_element("#checkBox1") sb.gui_drag_and_drop("img#logo", "div#drop2") sb.nested_click("iframe#myFrame3", ".fBox") sb.sleep(2) sb.driver.stop() ``` ``` -------------------------------- ### Install pip on CentOS 7 Source: https://seleniumbase.io/help_docs/install_python_pip_git On CentOS 7 and some Linux systems, pip can be installed using the yum package manager. ```bash yum -y update yum -y install python-pip ``` -------------------------------- ### Get Help for a Specific Command Source: https://seleniumbase.io/seleniumbase/console_scripts/ReadMe To get detailed information and usage for a specific command, use `sbase help [COMMAND]`. ```bash sbase help [COMMAND] ``` -------------------------------- ### Create MySQL Database and Import Tables (Standard Ubuntu) Source: https://seleniumbase.io/help_docs/mysql_installation Creates a new database named 'test_db' and imports tables from a SQL file. This version assumes a standard MySQL setup without explicit root password in the command. ```bash sudo mysql -e 'CREATE DATABASE IF NOT EXISTS test_db;' ``` ```bash sudo mysql -h 127.0.0.1 -u root test_db < seleniumbase/core/create_db_tables.sql ``` -------------------------------- ### Install Linux Dependencies Source: https://seleniumbase.io/integrations/azure/jenkins/ReadMe Run the Linuxfile.sh script to install all required dependencies for SeleniumBase on the Linux environment. See the script for details. ```bash ./Linuxfile.sh ``` -------------------------------- ### Create Test Directory Source: https://seleniumbase.io/seleniumbase/console_scripts/ReadMe Use `sbase mkdir` to create a new directory for your tests, optionally with configuration files. Specify the directory name and any desired options. ```bash sbase mkdir [DIRECTORY] [OPTIONS] ``` -------------------------------- ### Download and Install Geckodriver on Linux Source: https://seleniumbase.io/help_docs/webdriver_installation Manually download, extract, and install Geckodriver to `/usr/local/bin/` on a Linux system. Ensure the driver is executable. ```bash wget https://github.com/mozilla/geckodriver/releases/download/v0.35.0/geckodriver-v0.35.0-linux64.tar.gz tar xvfz geckodriver-v0.35.0-linux64.tar.gz mv geckodriver /usr/local/bin/ chmod +x /usr/local/bin/geckodriver ``` -------------------------------- ### Create and Play Tours with SeleniumBase Source: https://seleniumbase.io/examples/tour_examples/ReadMe Demonstrates creating multiple tours with different themes (dark and light) and adding steps to each. The tour is played after adding steps. ```python from seleniumbase import BaseCase BaseCase.main(__name__, __file__, "--uc") class MyTourClass(BaseCase): def test_google_tour(self): if not self.undetectable: self.get_new_driver(undetectable=True) self.open('https://google.com/ncr') self.click_if_visible('button:contains("Accept all")') self.wait_for_element('input[title="Search"]') self.hide_elements("iframe") self.create_tour(theme="dark") self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours") self.add_tour_step("Type in your query here.", '[title="Search"]') self.play_tour() self.highlight_type('input[title="Search"]', "Google") self.wait_for_element('[role="listbox"]') # Wait for autocomplete self.create_tour(theme="light") self.add_tour_step("Then click to search.", '[value="Google Search"]') self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]') self.play_tour() ``` -------------------------------- ### Download and Install Chromedriver on Linux Source: https://seleniumbase.io/help_docs/webdriver_installation Manually download, unzip, and install Chromedriver to `/usr/local/bin/` on a Linux system. Ensure the driver is executable. ```bash wget https://chromedriver.storage.googleapis.com/114.0.5735.90/chromedriver_linux64.zip unzip chromedriver_linux64.zip mv chromedriver /usr/local/bin/ chmod +x /usr/local/bin/chromedriver ``` -------------------------------- ### Verify Safari WebDriver Installation Source: https://seleniumbase.io/help_docs/verify_webdriver Verify that the WebDriver for Safari is installed and accessible. This code opens Safari and navigates to a specific page. ```python >>> from seleniumbase import get_driver >>> driver = get_driver("safari", headless=False) >>> driver.get("https://www.apple.com/safari") >>> driver.quit() >>> exit() ``` -------------------------------- ### List All SeleniumBase Commands Source: https://seleniumbase.io/seleniumbase/console_scripts/ReadMe Use `seleniumbase --help` to display a comprehensive list of all available console commands and their general usage. ```bash seleniumbase --help ```