Skip to content

W3c#599

Closed
mpierzchalski wants to merge 47 commits intophp-webdriver:communityfrom
mpierzchalski:w3c
Closed

W3c#599
mpierzchalski wants to merge 47 commits intophp-webdriver:communityfrom
mpierzchalski:w3c

Conversation

@mpierzchalski
Copy link

added W3C support

tested for:

  • selenium-3.14.0
  • geckodriver-0.21
  • latest Firefox
  • latest Chrome

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@williamdes
Copy link
Collaborator

@mpierzchalski This PR looks great !
Can you update this with what you implemented ?

Implemented | Method | URI Template | Command
-- | -- | -- | --
:heavy_check_mark:  | POST | /session | New Session
:heavy_check_mark: | DELETE | /session/{session id} | Delete Session
:x: | GET | /status | Status
:x: | GET | /session/{session id}/timeouts | Get Timeouts
:heavy_check_mark: | POST | /session/{session id}/timeouts | Set Timeouts
:heavy_check_mark: | POST | /session/{session id}/url | Navigate To
:heavy_check_mark: | GET | /session/{session id}/url | Get Current URL
:heavy_check_mark: | POST | /session/{session id}/back | Back
:heavy_check_mark: | POST | /session/{session id}/forward | Forward
:heavy_check_mark: | POST | /session/{session id}/refresh | Refresh
:heavy_check_mark: | GET | /session/{session id}/title | Get Title
:x: | GET | /session/{session id}/window | Get Window Handle
:heavy_check_mark: | DELETE | /session/{session id}/window | Close Window
:heavy_check_mark: | POST | /session/{session id}/window | Switch To Window
:x: | GET | /session/{session id}/window/handles | Get Window Handles
:heavy_check_mark: | POST | /session/{session id}/frame | Switch To Frame
:x: | POST | /session/{session id}/frame/parent | Switch To Parent Frame
:x: | GET | /session/{session id}/window/rect | Get Window Rect
:x: | POST | /session/{session id}/window/rect | Set Window Rect
:x: | POST | /session/{session id}/window/maximize | Maximize Window
:x: | POST | /session/{session id}/window/minimize | Minimize Window
:x: | POST | /session/{session id}/window/fullscreen | Fullscreen Window
:heavy_check_mark: | GET | /session/{session id}/element/active | Get Active Element
:heavy_check_mark: | POST | /session/{session id}/element | Find Element
:heavy_check_mark: | POST | /session/{session id}/elements | Find Elements
:heavy_check_mark: | POST | /session/{session id}/element/{element id}/element | Find Element From Element
:heavy_check_mark: | POST | /session/{session id}/element/{element id}/elements | Find Elements From Element
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/selected | Is Element Selected
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/attribute/{name} | Get Element Attribute
:x: | GET | /session/{session id}/element/{element id}/property/{name} | Get Element Property
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/css/{property name} | Get Element CSS Value
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/text | Get Element Text
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/name | Get Element Tag Name
:x: | GET | /session/{session id}/element/{element id}/rect | Get Element Rect
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/enabled | Is Element Enabled
:heavy_check_mark: | POST | /session/{session id}/element/{element id}/click | Element Click
:heavy_check_mark: | POST | /session/{session id}/element/{element id}/clear | Element Clear
:heavy_check_mark: | POST | /session/{session id}/element/{element id}/value | Element Send Keys
:heavy_check_mark: | GET | /session/{session id}/source | Get Page Source
:x: | POST | /session/{session id}/execute/sync | Execute Script
:x: | POST | /session/{session id}/execute/async | Execute Async Script
:heavy_check_mark: | GET | /session/{session id}/cookie | Get All Cookies
:x: | GET | /session/{session id}/cookie/{name} | Get Named Cookie
:heavy_check_mark: | POST | /session/{session id}/cookie | Add Cookie
:heavy_check_mark: | DELETE | /session/{session id}/cookie/{name} | Delete Cookie
:heavy_check_mark: | DELETE | /session/{session id}/cookie | Delete All Cookies
:x: | POST | /session/{session id}/actions | Perform Actions
:x: | DELETE | /session/{session id}/actions | Release Actions
:x: | POST | /session/{session id}/alert/dismiss | Dismiss Alert
:x: | POST | /session/{session id}/alert/accept | Accept Alert
:x: | GET | /session/{session id}/alert/text | Get Alert Text
:x: | POST | /session/{session id}/alert/text | Send Alert Text
:heavy_check_mark: | GET | /session/{session id}/screenshot | Take Screenshot
:x: | GET | /session/{session id}/element/{element id}/screenshot | Take Element Screenshot



W3 compatible | Method | URI Template | Constant
-- | -- | -- | --
:heavy_check_mark: | GET | /session/{session id}/cookie | GET_ALL_COOKIES
:heavy_check_mark: | POST | /session/{session id}/cookie | ADD_COOKIE
:heavy_check_mark: | DELETE | /session/{session id}/cookie | DELETE_ALL_COOKIES
:heavy_check_mark: | DELETE | /session/{session id}/cookie/{name} | DELETE_COOKIE
:heavy_check_mark: | POST | /session/{session id}/element | FIND_ELEMENT
:heavy_check_mark: | POST | /session/{session id}/elements | FIND_ELEMENTS
:heavy_check_mark: | POST | /session/{session id}/element/{element id}/clear | CLEAR_ELEMENT
:heavy_check_mark: | POST | /session/{session id}/element/{element id}/click | CLICK_ELEMENT
:x: | GET | /session/{session id}/element/{element id}/equals/:other | ELEMENT_EQUALS
:heavy_check_mark: | POST | /session/{session id}/element/{element id}/element | FIND_CHILD_ELEMENT
:heavy_check_mark: | POST | /session/{session id}/element/{element id}/elements | FIND_CHILD_ELEMENTS
:heavy_check_mark: | POST | /session/{session id}/element/active | GET_ACTIVE_ELEMENT
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/attribute/{name} | GET_ELEMENT_ATTRIBUTE
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/css/{property name} | GET_ELEMENT_VALUE_OF_CSS_PROPERTY
:x: | GET | /session/{session id}/element/{element id}/location | GET_ELEMENT_LOCATION
:x: | GET | /session/{session id}/element/{element id}/location_in_view | GET_ELEMENT_LOCATION_ONCE_SCROLLED_INTO_VIEW
:x: | GET | /session/{session id}/element/{element id}/size | GET_ELEMENT_SIZE
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/name | GET_ELEMENT_TAG_NAME
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/text | GET_ELEMENT_TEXT
:x: | GET | /session/{session id}/element/{element id}/displayed | IS_ELEMENT_DISPLAYED
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/enabled | IS_ELEMENT_ENABLED
:heavy_check_mark: | GET | /session/{session id}/element/{element id}/selected | IS_ELEMENT_SELECTED
:heavy_check_mark: | POST | /session/{session id}/element/{element id}/value | SEND_KEYS_TO_ELEMENT
:x: | POST | /session/{session id}/element/{element id}/submit | SUBMIT_ELEMENT
:heavy_check_mark: | DELETE | /session/{session id}/window | CLOSE
:heavy_check_mark: | POST | /session/{session id}/window | SWITCH_TO_WINDOW
:x: | GET | /session/{session id}/window_handle | GET_CURRENT_WINDOW_HANDLE
:x: | GET | /session/{session id}/window_handles | GET_WINDOW_HANDLES
:x: | GET | /session/{session id}/window/{windowHandle}/position | GET_WINDOW_POSITION
:x: | GET | /session/{session id}/window/{windowHandle}/size | GET_WINDOW_SIZE
:x: | POST | /session/{session id}/window/{windowHandle}/maximize | MAXIMIZE_WINDOW
:x: | POST | /session/{session id}/window/{windowHandle}/position | SET_WINDOW_POSITION
:x: | POST | /session/{session id}/window/{windowHandle}/size | SET_WINDOW_SIZE
:x: | POST | /session/{session id}/accept_alert | ACCEPT_ALERT
:x: | POST | /session/{session id}/dismiss_alert | DISMISS_ALERT
:x: | GET | /session/{session id}/alert_text | GET_ALERT_TEXT
:x: | POST | /session/{session id}/alert_text | SET_ALERT_VALUE
:x: | POST | /session/{session id}/execute | EXECUTE_SCRIPT
:x: | POST | /session/{session id}/execute_async | EXECUTE_ASYNC_SCRIPT
:heavy_check_mark: | POST | /session/{session id}/frame | SWITCH_TO_FRAME
:heavy_check_mark: | POST | /session/{session id}/url | GET
:heavy_check_mark: | GET | /session/{session id}/url | GET_CURRENT_URL
:x: | GET | /sessions | GET_ALL_SESSIONS
:x: | GET | /session/{session id}/log/types | GET_AVAILABLE_LOG_TYPES
:x: | POST | /session/{session id}/log | GET_LOG
:heavy_check_mark: | GET | /session/{session id}/source | GET_PAGE_SOURCE
:x: | GET | /session/{session id}/orientation | GET_SCREEN_ORIENTATION
:x: | GET | /session/{session id} | GET_CAPABILITIES
:heavy_check_mark: | GET | /session/{session id}/title | GET_TITLE
:heavy_check_mark: | POST | /session/{session id}/back | GO_BACK
:heavy_check_mark: | POST | /session/{session id}/forward | GO_FORWARD
:x: | POST | /session/{session id}/buttondown | MOUSE_DOWN
:x: | POST | /session/{session id}/buttonup | MOUSE_UP
:x: | POST | /session/{session id}/click | CLICK
:x: | POST | /session/{session id}/doubleclick | DOUBLE_CLICK
:x: | POST | /session/{session id}/moveto | MOVE_TO
:heavy_check_mark: | POST | /session | NEW_SESSION
:heavy_check_mark: | DELETE | /session/{session id} | QUIT
:heavy_check_mark: | POST | /session/{session id}/refresh | REFRESH
:x: | POST | /session/{session id}/file | UPLOAD_FILE
:x: | POST | /session/{session id}/keys | SEND_KEYS_TO_ACTIVE_ELEMENT
:x: | POST | /session/{session id}/timeouts/implicit_wait | IMPLICITLY_WAIT
:x: | POST | /session/{session id}/orientation | SET_SCREEN_ORIENTATION
:heavy_check_mark: | POST | /session/{session id}/timeouts | SET_TIMEOUT
:x: | POST | /session/{session id}/timeouts/async_script | SET_SCRIPT_TIMEOUT
:heavy_check_mark: | GET | /session/{session id}/screenshot | SCREENSHOT
:x: | POST | /session/{session id}/touch/click | TOUCH_SINGLE_TAP
:x: | POST | /session/{session id}/touch/down | TOUCH_DOWN
:x: | POST | /session/{session id}/touch/doubleclick | TOUCH_DOUBLE_TAP
:x: | POST | /session/{session id}/touch/flick | TOUCH_FLICK
:x: | POST | /session/{session id}/touch/longclick | TOUCH_LONG_PRESS
:x: | POST | /session/{session id}/touch/move | TOUCH_MOVE
:x: | POST | /session/{session id}/touch/scroll | TOUCH_SCROLL
:x: | POST | /session/{session id}/touch/up | TOUCH_UP

@mpierzchalski
Copy link
Author

mpierzchalski commented Sep 20, 2018

@williamdes it is hard to do it. I just translate all JsonWireProtocol commands into W3C. In that meaning all commands are implemented. But I do not give you 100% sure, that all of them work properly, because functional tests covers only bigger part of them :/ I can try to describe the translation by comparing both protocols, maybe this way would be more precise.

The main goal for me, was to add this W3C support, was to do not change interface of WebDriver, to keep all that changes hidden in source. So I do not use different commands depends on protocol, for ex. in case when user wants to change window's size, he do it in same way like before.

$driver->manage()->window()->setSize(new WebDriverDimension(100, 200));

The WebDriver after session being create, guesses in what dialect receive the response, and keep that information in memory. In case of W3C, the WebDriver will translate every single next command before its execution into W3C.

@OndraM
Copy link
Collaborator

OndraM commented Sep 20, 2018

Hi @mpierzchalski , thanks for you PR 👍 !
Have you seen PR #560 , where W3C partial support is already being implemented? I suggest merging the efforts - could you please have look and see if @dunglas won't seek any help with the PR?

Thanks 💯

@dunglas
Copy link
Contributor

dunglas commented Sep 20, 2018

@mpierzchalski don't hesitate to ping me on the Symfony Slack (or on Twitter)!

@dunglas
Copy link
Contributor

dunglas commented Sep 25, 2018

@OndraM, this one and #560 take a very different path:

  • this one use an abstract protocol that is then translated in the W2C or the JSONWire version
  • mine directly send the query in the good flavor regarding which protocol should be used

Also, it looks like this one is fully compatible with the current PHP API (tests and method signatures are changed), while mine tried to preserve BC.

Consequently, it's not possible to merge both PR, the approach is too different. Which one do you prefer we focus on?

@jmalinens
Copy link

nice work @mpierzchalski and @dunglas!

we are eager to use it when merged!

@OndraM
Copy link
Collaborator

OndraM commented Nov 10, 2019

This was in the end superseded by #560 . However big kudos to @mpierzchalski for working on this! 🥇

@OndraM OndraM closed this Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants