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

consider browser.perform(action_chains_object) #510

Open
yashaka opened this issue Jan 22, 2024 · 5 comments
Open

consider browser.perform(action_chains_object) #510

yashaka opened this issue Jan 22, 2024 · 5 comments

Comments

@yashaka
Copy link
Owner

yashaka commented Jan 22, 2024

just as a kind of shortcut to browser.perform(lambda driver: action_chains_object.perform())

where actions_chain_object = ActionChains(browser.driver).some().chain().of().commands() (without .perform() in the end of chain)

@yashaka
Copy link
Owner Author

yashaka commented Jan 22, 2024

probably something like this

browser.perform(command.chain(lambda actions: actions.click_and_hold().pause(1).release().perform())

as a shortcut to

browser.perform(lambda driver: ActionChains(driver).click_and_hold().pause(1).release().perform())

would be less efficient...

@yashaka
Copy link
Owner Author

yashaka commented Jan 22, 2024

we can use ideas from here

to implement even something like this:

browser.perform(command.chain.click_and_hold().pause(1).release())

where chain - is a property of command module, that each time "on get" returns new ActionChains object!
then browser.perform(action_chains_object) would really make a lot of sense!

@yashaka
Copy link
Owner Author

yashaka commented Jan 22, 2024

we can use ideas from here

to implement even something like this:

browser.perform(command.chain.click_and_hold().pause(1).release())

where chain - is a property of command module, that each time "on get" returns new ActionChains object! then browser.perform(action_chains_object) would really make a lot of sense!

hm, but this will only work with "selene.browser, i.e. the shared browser, not any other Browser instances", hence.. we can't use this Idea in such way...

@yashaka
Copy link
Owner Author

yashaka commented Jan 22, 2024

we can use ideas from here
to implement even something like this:

browser.perform(command.chain.click_and_hold().pause(1).release())

where chain - is a property of command module, that each time "on get" returns new ActionChains object! then browser.perform(action_chains_object) would really make a lot of sense!

hm, but this will only work with "selene.browser, i.e. the shared browser, not any other Browser instances", hence.. we can't use this Idea in such way...

but this could work:

browser.perform(command.chain().click_and_hold().pause(1).release())

where chain is defined as follows:

# command.py
import selene

def chain(driver: Optional[WebDriver] = None):
    return ActionChains(driver or selene.browser.driver)

@yashaka
Copy link
Owner Author

yashaka commented Jan 22, 2024

but this could work:

browser.perform(command.chain().click_and_hold().pause(1).release())

ok... why then not to go even further:

browser.actions().click_and_hold().pause(1).release().perform()

where actions is an instance of SeleneActionsChain that extends Selenium's ActionsChain and overrides .perform() method to utilize Selene's waiting!?

yashaka added a commit that referenced this issue Jan 25, 2024
+ move Browser class from entity.py to _browser.py
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

1 participant