Skip to content
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

How can I pass capabilities to Selenium::Edge? #464

Open
nck974 opened this issue Mar 9, 2021 · 3 comments
Open

How can I pass capabilities to Selenium::Edge? #464

nck974 opened this issue Mar 9, 2021 · 3 comments

Comments

@nck974
Copy link

nck974 commented Mar 9, 2021

Hello, thx for the implementation of #463 so quickly. Now I'm trying with the new veersion, but I'm not able to see how to forward settings to my edge driver. I have tried something as follows:

my $settings_ref = {
		binary =>'msedgedriver.exe',
		extra_capabilities =>
			{'ms:edgeOptions' => {
                            'debuggerAddress' => 'localhost:50923'
			}
		},
	};

Similar to what I do in chrome, but id does not seem to work, as dumping what get_capabilities returns states:

          'ms:edgeOptions' => {
                                'debuggerAddress' => 'localhost:51551'
                              },

This is what I'm trying to migrate to edge from chrome, but I'm not able to get it started:

	if (defined($args_ref->{'downloads_folder'})){
		$settings{'extra_capabilities'}{'goog:chromeOptions'}{'prefs'}{'download.default_directory'} = $args_ref->{'downloads_folder'};
		$settings{'extra_capabilities'}{'goog:chromeOptions'}{'prefs'}{'download.prompt_for_download'} = 'false';
		$settings{'extra_capabilities'}{'goog:chromeOptions'}{'prefs'}{'profile'}{'default_content_setting_values'}{'automatic_downloads'} = 1;
	}
@teodesian
Copy link
Owner

Gave it a spin, and am encountering similar difficulties.

https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options

Seems to suggest valid keys for the 'prefs' object is described in a config file "in the user data folder for microsoft edge".
Unfortunately I couldn't find anything of the sort for edge in %APPDATA% or %LOCALAPPDATA%, so I'm not real sure if there are differences versus chrome.

It could also just be their driver doesn't return that as part of the capabilities, though I regard that as unlikely.

@nck974
Copy link
Author

nck974 commented Mar 9, 2021

Is it possible that some line like this one is needed in the driver.pm ?:

    #Fix broken out of the box chrome because they hate the maintainers of their interfaces
    if ( $self->isa('Selenium::Chrome') ) {
        if ( exists $args->{desiredCapabilities} ) {
            $args->{desiredCapabilities}{'goog:chromeOptions'}{args} //= [];
            push(@{$args->{desiredCapabilities}{'goog:chromeOptions'}{args}}, qw{no-sandbox disable-dev-shm-usage});
        }
    }

in https://github.com/teodesian/Selenium-Remote-Driver/blob/master/lib/Selenium/Remote/Driver.pm#L1057

@teodesian
Copy link
Owner

possibly. Looking at that block I should also probably filter args[] thru List::Util::uniq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants