New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open Browser 'Options' object has no attribute '' #1877
Comments
This is due to how we parse the options string. I think that having a trailing semicolon should not throw an error. To me I could see one constructing this string somewhere and for each options adding a trailing semicolon. Thus it would be too much to ask that the last in the set does not contain a trailing semicolin. I think it is easy enough to ignore those although I see our parsing thinks that introduces another option. I was considering similar cases like, *** Test Cases ***
Chrome Browser with Selenium Options Ending With A Few Semicolons
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage") ; ; ;
Chrome Browser with Selenium Options Containing Empty Option
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; ; add_argument ( "--headless=new" ) In these I see the option as being empty for which a warning could be helpful. But we shouldn't warn that you have an empty option for just a trailing semicolon. |
Somewhat related, a recent question was asked on setting some download options for which the poster had this, the first test case, solution to their problem, *** Settings ***
Library SeleniumLibrary
*** Test Cases ***
Example Of Complex Selenium Options Using Create Dictionary
${Prefs}= Create Dictionary profile.default_content_settings.popups=0, download.default_directory=r"C:\\Users\\me\\test_downloads",download.prompt_for_download:False
Open Browser about:blank Chrome alias=UserCreate
... options=add_argument("--disable-popup-blocking"); add_argument("--ignore-certificate-errors"); add_argument("--disable-gpu"); add_argument("--disable-dev-shm-usage"); add_argument("--no-sandbox");add_argument("--disable-proxy-certificate-handler");add_experimental_option("prefs", ${Prefs})
Example Of Complex Selenium Options Using Options String
Open Browser about:blank Chrome alias=UserCreate
... options=add_argument("--disable-popup-blocking"); add_argument("--ignore-certificate-errors"); add_argument("--disable-gpu"); add_argument("--disable-dev-shm-usage"); add_argument("--no-sandbox");add_argument("--disable-proxy-certificate-handler");add_experimental_option("prefs", { 'profile.default_content_settings.popups' : 0 , 'download.default_directory' : r"C:\\Users\\me\\test_downloads" , 'download.prompt_for_download' : False } ) I was thinking one should be able to put this configuration in as a simple options string. One other side note is #4948 within robotfram,ework core might help with the visual problem that these options lines can get very long and would allow for multiline usage. |
Within the selenium options argument of the `Open Browser` keword, if there were trailing semicolons then the keyword would fail. With this change we allow trailing semicolons. In addition the library warns about emtpy options. Fixes robotframework#1877
When calling
open browser
withoptions
that ends with;
such as:Then the browser will fail to open with error:
Once I removed the last
;
then the browser was launched with the required options.Found in RF version 6.0
The text was updated successfully, but these errors were encountered: