There are times where we need to only move an image by a certain amount. A good example of this would be if you are working in a WYSIWYG editor and you wanted to just move an image to somewhere else but did not want to drop it on another element, you will be using dragAndDropBy(WebElement, x, y);.
Let us see this in action.
Open up inteliij and create a new Selenium WebDriver project.
Create a new class and a new test with the following code:
Run the test. You should see the following:
What just happened?
We have just seen how easy it is to do a drag-and-drop on the page by moving an item by an offset. You will have to pass in the element that you want to move and then the x and y offset that you want to move it by.
Doing a context click
If you are testing a highly rich application, like a WYSIWYG editor or an e-mail client, you will more than likely need to do a context click or right-click to get other menu items.This may seem like a simple task as a user but doing this within a browser and doing it programmatically has been a difficult task for some time. The interactions API allows us to do this and do it in a meaningful way.
We will now see it in action.
|
|
Selenium Related Tutorials |
|
---|---|
QTP Tutorial | JMeter Tutorial |
Software testing Tutorial | JUnit Tutorial |
TestNG Tutorial | SAP Testing Tutorial |
QUnit Testing Tutorial |
Selenium Related Interview Questions |
|
---|---|
SILK TEST Interview Questions | QTP Interview Questions |
JMeter Interview Questions | Automation Testing Interview Questions |
Software testing Interview Questions | JUnit Interview Questions |
TestNG Interview Questions | SAP Testing Interview Questions |
Selenium WebDriver Interview Questions | Selenium IDE Interview Questions |
QUnit Testing Interview Questions | Performance Testing Interview Questions |
Hadoop Testing Interview Questions |
Selenium Related Practice Tests |
|
---|---|
QTP Practice Tests | JMeter Practice Tests |
Software testing Practice Tests | JUnit Practice Tests |
Performance Testing Practice Tests |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.