Ejemplo n.º 1
0
def test_always_match_if_2_of_the_same_options():
    from selenium.webdriver.chrome.options import Options as ChromeOptions
    from selenium.webdriver.chrome.options import Options as ChromeOptions2

    co1 = ChromeOptions()
    co1.add_argument("foo")
    co2 = ChromeOptions2()
    co2.add_argument("bar")

    expected = {
        "capabilities": {
            "alwaysMatch": {
                "browserName": "chrome",
                "pageLoadStrategy": "normal",
            },
            "firstMatch": [
                {
                    "goog:chromeOptions": {
                        "args": ["foo"],
                        "extensions": []
                    }
                },
                {
                    "goog:chromeOptions": {
                        "args": ["bar"],
                        "extensions": []
                    }
                },
            ]
        }
    }
    result = webdriver.create_matches([co1, co2])
    assert expected == result
Ejemplo n.º 2
0
def test_first_match_when_2_different_option_types():
    from selenium.webdriver.chrome.options import Options as ChromeOptions
    from selenium.webdriver.firefox.options import Options as FirefoxOptions

    expected = {
        "capabilities": {
            "alwaysMatch": {
                "pageLoadStrategy": "normal"
            },
            "firstMatch": [{
                "browserName": "chrome",
                "goog:chromeOptions": {
                    "extensions": [],
                    "args": []
                }
            }, {
                "browserName": "firefox",
                "acceptInsecureCerts": True,
                "moz:debuggerAddress": True,
                "moz:firefoxOptions": {
                    "args": ["foo"]
                }
            }]
        }
    }

    result = webdriver.create_matches([ChromeOptions(), FirefoxOptions()])
    assert expected == result