Rename browser to driver#976
Conversation
|
But it definitely looks like my rebase with master did not go smoothly. Have to take a look later. |
|
I'd still use |
|
The |
src/SeleniumLibrary/__init__.py
Outdated
| WindowKeywords(self) | ||
| ] | ||
| self._browsers = BrowserCache() | ||
| self._webdrivers = WebDriverCache() |
There was a problem hiding this comment.
This should be _drivers to match driver.
src/SeleniumLibrary/base/context.py
Outdated
| @property | ||
| def browsers(self): | ||
| return self.ctx._browsers | ||
| def webdrivers(self): |
There was a problem hiding this comment.
This should be drivers to match driver.
| self.ctx.speed = timestr_to_secs(value) | ||
| for browser in self.browsers.browsers: | ||
| self._monkey_patch_speed(browser) | ||
| for driver in self.webdrivers.drivers: |
There was a problem hiding this comment.
Isn't ConnectionCache iterable? If it is, this could be just for driver in self.drivers. If it isn't, it should be changed!
There was a problem hiding this comment.
It should be iterable, but changes the code to only iterate drivers which are not closed.
d212b8e to
476cb6f
Compare
| self._running_on_failure_keyword = False | ||
|
|
||
| @property | ||
| def driver(self): |
| :rtype: selenium.webdriver.remote.webdriver.WebDriver | ||
| :raises RuntimeError if driver is not created | ||
| """ | ||
| if not self._drivers.current: |
There was a problem hiding this comment.
Strange error message. Perhaps this should still be No browser is open.? Also, should we use a dedicated exception?
There was a problem hiding this comment.
Yes, browser is better.
It's strange exception, but that is how the original code worked. Dedicated exception would be better, would NoBrowser be good?
There was a problem hiding this comment.
Perhaps NoOpenBrowser or NoBrowserOpen?
| if browser not in self._closed: | ||
| open_browsers.append(browser) | ||
| return open_browsers | ||
| def get_open_drivers(self): |
There was a problem hiding this comment.
Open driver sounds a bit odd. Should this perhaps be get_active_browsers()? Or perhaps property active_browsers?
There was a problem hiding this comment.
Did go with active_drivers
pekkaklarck
left a comment
There was a problem hiding this comment.
Looks great. Added few line notes, though.
476cb6f to
2faa957
Compare
|
|
||
| def __init__(self): | ||
| ConnectionCache.__init__(self, no_current_msg='No current browser') | ||
| ConnectionCache.__init__(self, no_current_msg='No current driver') |
There was a problem hiding this comment.
This should still say browser. And have . at the end.
If that message is ever used, it's used by ConnectionCache as a message for RuntimeError. We have our own NoOpenBrowser now, but there's no good API to use that here. We could set self._no_current to an object using our exception (and it could extend NoConnection) but I'm not sure is that worth the effort.
There was a problem hiding this comment.
I did change to driver -> browser.
If the start seeing the RuntimeErrorin real life, lets then decide what we should do.
| :rtype: selenium.webdriver.remote.webdriver.WebDriver | ||
| :raises RuntimeError if driver is not created | ||
| """ | ||
| if not self._drivers.current: |
There was a problem hiding this comment.
- Exception type not updated in the doc string above.
- This error message could have
.at the end.
Also created public API browser for RC1 to support early adopters.
Contains changes in the internal variables and method names.
The WindowManager used to pass driver between methods. Now the methods use self.driver, instead of passing the diver as argument.
f24f1ca to
c8a7c2f
Compare
| def driver(self): | ||
| """Current active driver. | ||
|
|
||
| :rtype: selenium.webdriver.remote.webdriver.WebDriver |
There was a problem hiding this comment.
Thought it would raise NoOpenBrowser....
To do:
browserin many places where it should saydriverself.browser