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

Support for EventListener #54

Open
aik099 opened this issue Jun 19, 2014 · 6 comments · May be fixed by #130
Open

Support for EventListener #54

aik099 opened this issue Jun 19, 2014 · 6 comments · May be fixed by #130
Assignees

Comments

@aik099
Copy link
Contributor

aik099 commented Jun 19, 2014

In Ruby's client for WebDriver protocol there is a way to place event listeners on various events on WebDriver side (see https://code.google.com/p/selenium/source/browse/rb/lib/selenium/webdriver/support/abstract_event_listener.rb, http://elementalselenium.com/tips/55-wrapper).

Is it possible to do the same in PHP WebDriver version?

@robocoder
Copy link
Member

Theoretically, this is possible.

In lieu of aspects for cross cutting concerns, I'm not opposed to this.

@aik099
Copy link
Contributor Author

aik099 commented Jun 19, 2014

What I want this for is to be able to set expectations for alert/prompt/confirm dialog before they happen. Ideally knowing if executed WebDriver command resulted in alert/prompt/confirm dialog opening without extra API call would be great as well.

@robocoder
Copy link
Member

@robocoder
Copy link
Member

This is now PSR-14.

Interfaces require PHP 7.2+

@robocoder robocoder self-assigned this Apr 15, 2022
@robocoder
Copy link
Member

Brainstorming:

  • consumer calls ServiceFactory to register their event dispatcher (whatever implements PSR14)
  • AbstractWebDriver::curl() would dispatch the before/after events to the registered event dispatcher
  • listeners would not be able to modify the request/response, or interrupt flow (eg throwing exception)

As for the event object, at minimum:

  • before, url
  • after, url, status

Stumbling blocks:

  • Whether or not to include post parameters (ie can be large for upload file)
  • Whether or not to include the response value (ie can be large for page source, screenshot, and download file)
  • Parsing the url will be messy to figure out which webdriver command will be/was executed.

So, I think we should be identifying the webdriver command before calling AbstractWebDriver::curl(). This is complicated by the commands that we declare via @method and use via __call().

@robocoder robocoder linked a pull request Dec 9, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants