I bring provided unlike examples of how to bargain amongst J Query elements using selenium WebDriver similar Drag together with drib chemical constituent using dragAndDrop method, Drag together with drib chemical constituent using dragAndDropBy method, Selecting multiple Items using clickAndHold method, Moving slider using clickAndHold together with moveByOffset method. To perform all these actions/operations, We bring used unlike methods of selenium webdriver advanced user Interactions API course of teaching Actions.
Now allow me laissez passer on yous 1 to a greater extent than related instance where yous wants to resize JQuery rezizable element. To perform this operation, First nosotros bring to locate bottom-right side corner of resizable element together with hence nosotros tin motion that corner past times specific start In X-Y directions.
package Testing_Pack; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.interactions.Actions; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; world course of teaching ResizeElement { WebDriver driver = null; @BeforeTest world void setup() throws Exception { driver = novel FirefoxDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); driver.get(" "); } @Test world void selectItems() throws InterruptedException { //Locate resizable element's bottom-right corner. WebElement resizeElement = driver.findElement(By.xpath("//div[@id='resizable']/div[3]")); //To resize jQuery resizable chemical constituent past times 250 pixel X,Y start using dragAndDropBy method of Actions class. novel Actions(driver).dragAndDropBy(resizeElement, 250, 250).build().perform(); Thread.sleep(5000); //After v seconds, This volition resize jQuery resizable chemical constituent past times -100 pixel X,Y start using the combination of clickAndHold, moveByOffset together with free methods of Actions class. novel Actions(driver).clickAndHold(resizeElement).moveByOffset(-100,-100).release().perform(); } }
You tin purpose unmarried method dragAndDropBy or combination of clickAndHold and moveByOffset methods to perform this functioning equally shown In higher upwardly example. You tin conduct function It In your eclipse together with verify the result.