Skip to content

How to use chrome for testing browser?

image.png

chrome_profile.yaml
Prefs:
profile:
default_content_setting_values:
geolocation: 2

Testcase.robot
*** Settings ***
Library SeleniumLibrary timeout=${Global_Timeout}
Library OperatingSystem
Library Collections

Suite Setup Prepare suite setup
# Test Teardown Sleep 3


Variables ${CURDIR}/chrome_profile.yaml

*** Variables ***
${Global_Timeout} 10s
${Home} ${EMPTY}
${Chrome_Path} /Documents/chrome/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing
${Chrome_Driver_Path} /Documents/chrome/chromedriver
${Chrome_Options} ;add_argument("--window-size=1980,1080");add_experimental_option("detach", ${True});add_argument("--disable-notifications")


*** Keywords ***
Prepare suite setup
Log Environment Variables
${Home} Get Environment Variable HOME
Set Suite Variable ${Home}


Open Browser Chrome
[Arguments] ${url}
${disable_location} Set Variable ;add_experimental_option("prefs",${Prefs})

Open Browser ${url} GC
... options=binary_location="${Home}${Chrome_Path}"${Chrome_Options}${disable_location}
... executable_path=${Home}${Chrome_Driver_Path}


Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.