I have a Selenium Browser config setup which has the following setup:
download_path = '/Users/my.user/Downloads'
# Setting capabilities for my browser
caps = Selenium::WebDriver::Remote::Capabilities.chrome
caps['goog:chromeOptions'] = {
'prefs' => {
'download.default_directory' => download_path,
'download.prompt_for_download' => false,
'profile.default_content_settings.popups' => 0
},
'args' => [
# 'disable-dev-shm-usage',
'no-sandbox',
'disable-popup-blocking',
'window-size=1400,900',
'disable-extensions',
'disable-gpu'
]
}
caps['goog:chromeOptions']['prefs']['plugins.always_open_pdf_externally'] = true
# Trying to run this in AWS DeviceFarm
devicefarm = Aws::DeviceFarm::Client.new(region: 'us-west-2', access_key_id: ACCESS_KEY_ID,
secret_access_key: SECRET_ACCESS_KEY)
test_grid_url_response = devicefarm.create_test_grid_url(project_arn: ARN, expires_in_seconds: 3000)
remote_url = test_grid_url_response.url
# Setting up a HTTP client to run it in DeviceFarm
client = Selenium::WebDriver::Remote::Http::Default.new
client.read_timeout = 5000
# Setting up the browser
driver = Selenium::WebDriver.for :remote, http_client: client, url: remote_url, capabilities: caps
url = 'https://www.google.com/'
driver.manage.timeouts.implicit_wait = 30
I am trying to access a downloaded file on the Windows remote machine from my local machine, but I am unable to.
I have a lambda written for file uploads, which goes like this:
driver.file_detector = lambda do |args|
str = args.first.to_s
str if File.exist?(str)
end
But I am not able to access any remotely downloaded file from my local machine.
Can anyone suggest any methods to accomplish the same?
I have tried Ruby-based File.open("C:\\Users\\testnode\\Downloads\\file_name")
which has failed with the following error message:
./sample.rb:46:in `initialize': No such file or directory @ rb_sysopen - C:\Users\testnode\Downloads\file_name
(Errno::ENOENT)
from ./sample.rb:46:in `open'
from ./sample.rb:46:in `<main>'