Replies: 5 comments
-
Another thing that can be done with the Action class is to easily provide some useful methods to the WebDriver and WebElement classes, as in this example that exposes DragAndDrop functionality: Add this this to the WebDriver class:
And add this to the WebElement class:
Here is a use case:
|
Beta Was this translation helpful? Give feedback.
-
I modified the Action class above to be more in line with Selenium Python usage - the actions are stored in a queue and then executed when the Perform method is called. However, I do not understand the functional need for the reset_actions method in Selenium Python, and so I made that method (ResetActions) private and call it in Perform once the action queue is executed. If anyone out there (is there anyone out there?) knows of a compelling usage case for reset_actions then I would be interested in hearing about it. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Added Clear method to Action.cls... |
Beta Was this translation helpful? Give feedback.
-
For completeness, I modified Action.cls by adding a private function SyncChannels that processes an unsynchronized set of action input channels to create a two-channel (keyboard and pointer) synchronized action chain that can be passed as a single call to the Selenium action processor (see https://www.w3.org/TR/webdriver/#actions). Performance testing that I did shows that on typically sized action chains, synchronizing the input channels is only about 5-10% faster. And under extreme test cases, such sending 1000's of actions, it can be a lot slower than multi-calls. |
Beta Was this translation helpful? Give feedback.
-
I added Action.cls support for "wheel" actions ScrollBy() and ScrollToElement()... |
Beta Was this translation helpful? Give feedback.
-
The information below roughs out an interface for emulating Selenium action chains using the CMD_W3C_ACTIONS command.
First, we need the Keyboard class that I shared from the SendKeys Method discussion.
Also the following changes must be made to the json_Encode function in JSonConverter.bas as suggested by @ezagdd here:
Please Note: Below I'm using the coding styles that I discuss in The Execute Method Issue and The WebElement ID Issue discussions. But if you love dealing with WebElement ID strings instead, then it would not be difficult to convert the code below back to that style. 🙂
Here is the Action class:
Add the following to the WebDriver class to expose the action chain:
Here is a usage case for drag and drop:
Beta Was this translation helpful? Give feedback.
All reactions