MinkSelenium2Driver icon indicating copy to clipboard operation
MinkSelenium2Driver copied to clipboard

Allow subclassing of Selenium2Driver class

Open gggeek opened this issue 9 years ago • 8 comments
trafficstars

Currently I have a problem with subclassing the Selenium2 driver (I created a version which adds support for extra SauceLabs features): the method setWebDriver() is typehinted to WebDriver, which is a final class. I am passing in my own version of a WebDriver, which extends AbstractWebDriver, and to make it work have reimplemented the setWebDriver method in my subclass of Selenium2Driver. But the fact that the reimplementation removes the typehinting generates a php strict error, which can make the test fail depending on php configuration.

In short: I think that setWebDriver method should use a 'wider' typehinting

gggeek avatar Feb 17 '16 16:02 gggeek

PS: Maybe this could be fixed in the webdriver repo... creating an issue there

https://github.com/instaclick/php-webdriver/issues/71

gggeek avatar Feb 17 '16 17:02 gggeek

We cannot typehint AbstractWebDriver, as we rely on methods not available in it.

stof avatar Feb 17 '16 17:02 stof

Exact. That's why I proposed this: https://github.com/instaclick/php-webdriver/pull/72

gggeek avatar Feb 17 '16 17:02 gggeek

@gggeek what kind of features have you added ?

stof avatar Feb 17 '16 17:02 stof

The WebDriverInterface, which sports the only method I saw used in the Selenium2Driver: session()

gggeek avatar Feb 17 '16 17:02 gggeek

What I'm asking is what kind of features you are adding in your subclass.

stof avatar Feb 17 '16 18:02 stof

Sorry, I realized that after answering.

Support for a proxy (it gets injected from selenium2driver into the webdriver)

You can see it here: https://gist.github.com/gggeek/cf534864273e7fa8dfec

gggeek avatar Feb 17 '16 18:02 gggeek

I've commended on https://github.com/instaclick/php-webdriver/issues/71.

I think, that for now ability to specify curl options for every curl call made in WebDriver, that later you specify upon Mink driver instantiation would be what you're after.

aik099 avatar Feb 18 '16 00:02 aik099