LeonH
LeonH

Reputation: 1037

How can I run Robot Framework tests in Opera/Safari?

I want to run my Robot Framework tests in the Opera browser. I know that Opera and Chrome share a webkit so first I tried to run my tests in Opera (using the Chrome webdriver) after successfully running them in chrome. It failed so I then followed Selenium's link to their webdrivers but there is no link for downloading an Opera webdriver.

How can I run my tests in Opera and Safari? Neither of these browsers seem to have webdrivers out there.

Edit- My research found that at the minute my only option seems to be downloading the source code for Selenium and then compiling it using the opera webdriver as a .jar file and then recompiling to an .exe everytime the browser is updated

Upvotes: 1

Views: 4290

Answers (3)

Cees Timmerman
Cees Timmerman

Reputation: 19682

According to the Robot Framework documentation:

> pip install robotframework-browser
> rfbrowser init

rfbrowser is in your Python bin folder. Safari uses webkit, and Opera uses chromium now:

from Browser import Browser
from Browser.utils.data_types import SupportedBrowsers

b = Browser(timeout="20 s", retry_assertions_for="500 ms")
b.new_browser(browser=SupportedBrowsers.webkit)
b.new_context(
    acceptDownloads=True,
    viewport={"width": 1920, "height": 1080},
    httpCredentials={"username": "admin", "password": "123456"},
)
b.new_page("https://playwright.dev")
assert b.get_text("h1") == "🎭 Playwright"
b.close_browser()

Upvotes: 0

Serhii Aksiutin
Serhii Aksiutin

Reputation: 637

config.py

technology_preview = '/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver'

test.robot

*** Settings ***
Library           Selenium2LibraryExtended
Variables         config.py
Test Teardown     Close All Browsers

*** Test Cases ***
    Create Webdriver  Safari  executable_path=${technology_preview}
    Go to  https://developer.apple.com/safari/technology-preview/

p.s. Don't forget to use two spaces for Test Cases table

Upvotes: 1

Goffity
Goffity

Reputation: 144

This maybe driver you're looking for.

https://github.com/operasoftware/operachromiumdriver/releases

You will install this webdriver and re-run the script test. It will be success with opera browser.

Upvotes: 1

Related Questions