Can't run Chrome with some prefs

1,022 views
Skip to first unread message

Vitaly C

unread,
Apr 19, 2017, 12:59:08 AM4/19/17
to robotframework-users

Hi


In Chrome (since version 57) there is changes of PDF viewer plugin. I want to turn off preview and download PDF. I used this answer and tried to implement in a such way:
${chrome options}= | Evaluate | sys.modules['selenium.webdriver'].ChromeOptions() | sys, selenium.webdriver
${prefs}= | Create Dictionary | download.default_directory=${download directory} | plugins.always_open_pdf_externally=true
Call Method | ${chrome options} | add_experimental_option | prefs | ${prefs}
Create Webdriver | Chrome | chrome_options=${chrome options}


Result:
download.default_directory - set correctly
plugins.always_open_pdf_externally - doesn't set

Also I tried browser.show_home_button=true but no luck here too


What I'm doing wrong, please help.


I have installed:

  • robotframework-3.0.2
  • robotframework-selenium2library-1.8.0
  • selenium-3.3.3

Vitaly C

unread,
Apr 19, 2017, 2:13:05 AM4/19/17
to robotframework-users
Resolved with this approach

среда, 19 апреля 2017 г., 7:59:08 UTC+3 пользователь Vitaly C написал:

Shaikh Shariq

unread,
May 23, 2018, 10:43:25 AM5/23/18
to robotframework-users
You can use the keyword below without creating python file. Note the difference of creating dictionary object and use of ${TRUE} instead of True.

Open Chrome Browser

    $
{chrome options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.
webdriver
    $
{prefs}    Create Dictionary    download.default_directory    ${CURDIR}    plugins.always_open_pdf_externally    ${TRUE}
   
Log    ${prefs}
    $
{val}=    Call Method    ${chrome options}    add_experimental_option    prefs    ${prefs}
   
Log    ${val}
   
Log    ${chrome options}
   
Log    ${chrome options.experimental_options}

   
Create Webdriver    Chrome    chrome_options=${chrome options}
Reply all
Reply to author
Forward
0 new messages