I want to automate tests for a website using Robotframework and Selenium on Windows 10. Form the Robot framework I need to pen the browser (Chrome or Firefox) using an extension ( using SwitchyOmega or FoxyProxy extension).
Robot Framework using Selenium open in Chromdriver or geckodriver. However the extension is not here. I can manually add the extension on the opened browser. However it goes away when the browser is closed How to install the extension permanently in the Chromdriver or geckodriver, so it is there when I launch the chromedrive ror the geckodriver from selenium using the Robot Framework.
While the SeleniumLibrary documentation technically explains this, its definitely not clear and took a lot of trial and error before I figured this out. Capabilities are options that you can use to customize and configure a ChromeDriver session. https://sites.google.com/a/chromium.org/chromedriver/capabilities same at https://chromedriver.chromium.org/capabilities ). gives unknown keyword errors at the the Robot Framework Attempted the following
Above runs but does not give the chrome browser with the desire results My environment and browser set up is OK. I can open the browser with my desired profile from the Windows command line
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Default"
I can also open the Firefox with desired profile from te Python/Selenim script .However I can not use the ”, RF keywords from the Robot Framework. Same problem described at "No Browser is Open" issue is coming when running the Robot framework script and "No Browser is Open" issue is coming when running the Robot framework script.
In summary , I need help to open a browser with desire profile or desired extension fro Robot framework .
Here is my code.
*** Settings ***
Library SeleniumLibrary
Library OperatingSystem
*** Variables ***
${Browser} Chrome
${URL} myurl
*** Test Cases ***
User must sign in to check out
[Documentation] This is some basic info about the test
[Tags] Smoke
${chrome_options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
#Call Method ${chrome options} add_argument incognito
Call Method ${chrome options} add_argument user-data-dir\=C:\\Users\\ts7237\\AppData\\Local\\Google\\Chrome\\User Data\\Default
Call Method ${chrome options} add_extension C:\\Users\\ts7237\\PycharmProjects\\first script\\Resources\\padekgcemlokbadohgkifijomclgjgif\\2.5.21_0.crx
${dc} Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys, selenium.webdriver
${Options}= Call Method ${ChromeOptions} to_capabilities
Create WebDriver Chrome chrome_options=${chrome_options} desired_capabilities=${dc}
Maximize Browser Window
${title}= Get Title
log many ${title}
# switching to new tab and do
select Window title= SwitchyOmega Options
#${newtabtitle}= Get Title
${title}= Get Title
log many ${title}
Go To ${URL}
close Window title= SwitchyOmega Options