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

use more readable and natural selene.browser.* over selene.tools.* #101

Closed
yashaka opened this issue Feb 23, 2017 · 3 comments
Closed

use more readable and natural selene.browser.* over selene.tools.* #101

yashaka opened this issue Feb 23, 2017 · 3 comments
Assignees

Comments

@yashaka
Copy link
Owner

yashaka commented Feb 23, 2017

depracate:

selene.tools.quit_driver()
selene.tools.get_driver()
selene.tools.set_driver()
selene.tools.visit()
selene.tools.s()
selene.tools.element()
selene.tools.ss()
selene.tools.elements()
selene.tools.take_screenshot()
selene.tools.latest_screenshot()
selene.tools.wait_to()
selene.tools.execute_script()

use instead:

selene.browser.quit()
selene.browser.close() # maybe even rename it to close_tab() or close_current_tab() becaue people used to misunderstand  quit and close... 
selene.browser.driver()
selene.browser.set_driver()
selene.browser.visit()
selene.browser.s()
selene.browser.element()
selene.browser.ss()
selene.browser.elements()
selene.browser.take_screenshot()
selene.browser.latest_screenshot()
selene.browser.wait_to()
selene.browser.should() # as an alias for wait_to in order to write something like browser.should(have.url("..."))
selene.browser.execute_script()
@yashaka yashaka self-assigned this Feb 23, 2017
@yashaka
Copy link
Owner Author

yashaka commented Feb 23, 2017

Open Points...

1
browser.quit() is readable and nice...
but if somebody will do
from selene.browser import quit

then he will hide the python's standard quit function...

so if somebody would be interested in "direct import", would it be better to have browser.quit_driver() alias for browser.quit() ?
should we even bother about this?

2
do we need a browser.close_current_window() alias for browser.close() to be more obvious and verbose?
what is actually meant under "window handle" in webdriver? are common tabs also considered as window handles?

maybe then the better name would be browser.close_current_tab ?

should we encourage users to be explicit and do not use "direct imports", i.e. prever browser.visit("http://google.com") over visit("http://google.com")
?

then would it be better to remove s, ss from selene.browser.py and move them somewhere to selene.support.jquery_style_selectors.py ?

and leave in selene.browser.py only browser.element and browser.elements or browser.all?

otherwise it would be a bit weird to use such kind of imports:

from selene import browser
from selene.browser import s, ss
...
browser.visit("http://google.com")
s(by.name("q")).set_value("selenium").press_enter()
ss(".srg .g").should(have.text("selenium automates browsers"))

or no?

@SergeyPirogov
Copy link
Contributor

  1. quit_driver()
  2. browser.close() is better for me
  3. I think users should decide themselves what is better explicit import or explicit

@yashaka
Copy link
Owner Author

yashaka commented Mar 1, 2017

  1. Ok, will leave both: browser.quit() fro those who will use module import and browser.quit_driver() for those who will use direct import...

  2. will leave browser.close() for sure then, and question about adding additional alias close_current_tab or close_current_window will postpone in separate issue: browser.close_current_tab or browser.close_current_window alias for browser.close() ? #102

  3. ok... we can officially not encourage users to use specific way of imports...
    but... isn't it a good idea to more s/ss to selene.support.jquery_style_selectors.py ?
    nevertheless browser.s and browser.ss looks awkward...

yashaka added a commit that referenced this issue Mar 1, 2017
…e way fixed found bugs in elements.py impl when calling global browser directly - the self._webdriver should be called instead...
yashaka added a commit that referenced this issue Mar 1, 2017
yashaka added a commit that referenced this issue Mar 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants