danwagnerco / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
1 stars 0 forks source link

Set Chrome flags with ChromeOptions #70

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Operating system : Win7
SeleniumWrapper version : 1.0.19.0

I am wondering if it is possible to set Chrome flags from Selenium-VBA?

Eg from Selenium it would be something like this:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('--allow-file-access-from-files')
driver = webdriver.Remote(desired_capabilities=options.to_capabilities())

I couldn't find access to the ChromeOptions in selenium-vba however.
I am attempting to launch a local HTML file which needs access to local files, 
and this is only possible in Chrome if you set this flag.

Any thoughts?
Thanks,
Lucas

Original issue reported on code.google.com by luke....@gmail.com on 19 May 2014 at 8:24

GoogleCodeExporter commented 9 years ago
Yes, it 's possible. Here is an example to start Chrome maximized and to 
automatically download files to a directory:

Dim wd As New SeleniumWrapper.WebDriver

'To start chrome maximized
wd.addArgument "--start-maximized"

'To automatically download  files to a directory
wd.setPreference "download.default_directory", "c:\"
wd.setPreference "download.directory_upgrade", true
wd.setPreference "download.extensions_to_open", ""
wd.setPreference "download.prompt_for_download", false

wd.start "chrome", "http://www.google.com"

Original comment by florentbr on 19 May 2014 at 8:41

GoogleCodeExporter commented 9 years ago
Hi Florent,

Thanks for your prompt response!
I have tried what you suggested - it appears the "--start-maximized" flag you 
showed works fine, however I can't seem to start it with the 
"--allow-file-access-from-files" flag.
I'm wondering if it has something to do with administrative rights being needed?
I ensured all other instances of Chrome were shut down before testing my script.

Original comment by luke....@gmail.com on 19 May 2014 at 11:15

GoogleCodeExporter commented 9 years ago
Sorry Florent - realised I had something wrong in my HTML string, not a problem 
with selenium.
Thanks again - all working now.

Original comment by luke....@gmail.com on 19 May 2014 at 11:21

GoogleCodeExporter commented 9 years ago

Original comment by florentbr on 8 Sep 2014 at 5:40