Open ylavoie opened 3 years ago
Strong suspicion this is related to what is happening in #468.
You should probably use a javascript workaround:
$element->execute_script(qq{
var elem = arguments[0];
return elem.value;
});
If that still fails, then there's something seriously wrong with firefox driver. I guess the layoffs have really done a number on mozilla.
It works perfectly well with the polyfill so, as we both guessed, the Firefox driver has to be the problem.
The final answer was not to polyfill WebElement but the fact that Chrome & Opera (same engine) and thus most probably Microsoft Edge now, do fallback on get_attribute when get_property fails.
For JSONWIRE compatibility, we were calling get_attribute($element,1) to force it even on WD3 enabled browsers. The final solution was this:
sub get_attribute {
my ($self, $id, $att) = @_;
my $element = $self->_resolve_id($id); # Get the WebElement
my $value;
$value = $element->get_attribute($att) # Try with property/attribute
if $self->_driver->{is_wd3};
return $value
// $element->get_attribute($att,1); # Force using attribute
}
That fixed it for Firefox and allowed us to test with it, along with Chrome, Opera and even PhantomJS
In retrospect the "do exactly what the user requests" approach clearly was the wrong one, what everyone actually wants is DWIM, and the browser drivers themselves have embraced that. So, I will simply rip out this bit and make it DWIM by default.
We are doing tests using a Selenium hub latest (3.141.59) and multiple browsers. Although Chrome & Opera works perfectly Firefox hangs while trying to get a value from a TEXTAREA. Even the old PhantomJS works on standalone
We are using S::R::D 1.42 and here is the debug log from the driver with Firefox:
The same test using chrome gives the desired
Part 1
value.Because 3 browsers are working, we do suspect Firefox. Any suggestion for a workaround?