Selenium - sgml/signature GitHub Wiki

Selenese

<?xml version="1.0" encoding="UTF-8"?>
<TestCase seleniumIDEVersion="1.0.7" baseURL="http://mywebsite/">
<selenese>
    <command>open</command>
    <target><![CDATA[/?p=1337]]></target>
    <value><![CDATA[]]></value>
</selenese>
<selenese>
    <command>assertTextPresent</command>
    <target><![CDATA[future success]]></target>
    <value><![CDATA[]]></value>
</selenese>
<!--this is a selenium comment-->
<selenese>
    <command>clickAndWait</command>
    <target><![CDATA[link=companies]]></target>
    <value><![CDATA[]]></value>
</selenese>
<selenese>
    <command>type</command>
    <target><![CDATA[inputSearch]]></target>
    <value><![CDATA[awesome]]></value>
</selenese>
</TestCase>

Debugger Protocol

Firefox

firefox.exe -start-debugger-server 9222

Python Webdriver

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

def attach_to_browser(browser_name):
    options = None
    if browser_name == "chrome":
        options = webdriver.ChromeOptions()
        options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
        driver = webdriver.Chrome(options=options)
    elif browser_name == "firefox":
        options = webdriver.FirefoxOptions()
        options.set_preference("devtools.debugger.remote-enabled", True)
        options.set_preference("devtools.debugger.prompt-connection", False)
        driver = webdriver.Firefox(options=options)
    elif browser_name == "edge":
        options = webdriver.EdgeOptions()
        options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
        driver = webdriver.Edge(options=options)
    else:
        raise ValueError("Unsupported browser!")
    return driver

def scroll_page(driver):
    body = driver.find_element_by_tag_name('body')
    while True:
        body.send_keys(Keys.PAGE_DOWN)
        time.sleep(15)

if __name__ == "__main__":
    browser_name = input("Enter the browser name (chrome, firefox, edge): ").lower()
    driver = attach_to_browser(browser_name)
    scroll_page(driver)

Dockerizing

https://developers.google.com/web/tools/puppeteer/troubleshooting

https://github.com/MicrosoftDocs/Virtualization-Documentation/issues/214

https://robotninja.com/blog/introduction-using-selenium-docker-containers-end-end-testing/

https://sandro-keil.de/blog/selenium-grid-in-minutes-with-docker/

https://hub.docker.com/r/smartie19889/selenium https://dzone.com/articles/deploying-selenium-grid-using-docker

https://medium.com/@aandryashin/selenium-on-windows-docker-revolution-f5a7eab205ad

https://www.slideshare.net/IvanKroutov/windows-browsers-how-to-run-them-in-docker-containers

https://www.jamesbaum.co.uk/blether/set-up-internet-explorer-virtual-machines-access-docker/

https://robotninja.com/blog/introduction-using-selenium-docker-containers-end-end-testing/

https://docs.docker.com/v17.09/engine/userguide/networking/#use-a-proxy-server-with-containers

https://github.com/SeleniumHQ/docker-selenium

https://www.qatouch.com/blog/how-to-run-selenium-webdriver-with-docker/

https://www.kenst.com/2018/09/how-to-run-your-selenium-tests-headlessly-in-docker/

https://examples.javacodegeeks.com/core-java/selenium-grid-docker-tutorial/

VMWareimg

References

⚠️ **GitHub.com Fallback** ⚠️