DWQA Ask QuestionCategory: QuestionsAssignment: Complete all the Operations using Actions for Site jqueryUI.com
admin Staff asked 5 years ago

Perform all the Operations on site: https://jqueryui.com/

  1. Draggable
  2. Droppable
  3. Resizable
  4. Selectable
  5. Sortable
  6. AutoComplete
  7. CheckBox Radio
  8. Control Group
  9. Date Picker
  10. Dialog
  11. Menu
  12. Select Menu
  13. Slider
  14. Spinner as Alert and Handling Enable and Disabled
  15. Tooltip
31 Answers
Pallavi Gadale Staff answered 5 years ago

2.Resizable:
Actions act=new Actions(driver);  //crate an obj of action classdriver.get(\”http://jqueryui.com/resizable/\”);
driver.switchTo().frame(0);   //switching the frame
WebElement source=driver.findElement(By.xpath(\”//*[@id=\’resizable\’]/div[3]\”));
act.clickAndHold(source).moveByOffset(200,50).release(source).build().perform();
Thread.sleep(5000);

Pallavi Gadale Staff answered 5 years ago

3.selectable:
Actions act=new Actions(driver); //create obj of action class
driver.get(\”http://jqueryui.com/selectable/\”);
driver.switchTo().frame(0); //switch from one frame to another         
WebElement item1=driver.findElement(By.xpath(\”//*[@id=\’selectable\’]/li[1]\”));
WebElement item2=driver.findElement(By.xpath(\”//*[@id=\’selectable\’]/li[3]\”));
act.click(item1).click(item2).build().perform(); //select individual Thread.sleep(3000);
act.clickAndHold(item1).moveToElement(item2).build().perform();  //select in a group
Thread.sleep(3000);
driver.quit(); 

Pallavi Gadale Staff answered 5 years ago

4.sortable:
Actions act =new Actions(driver);
driver.get(\”http://jqueryui.com/sortable/#default\”);
driver.switchTo().frame(0);     
WebElement item1=driver.findElement(By.xpath(\”//*[@id=\’sortable\’]/li[1]\”));
WebElement item2=driver.findElement(By.xpath(\”//*[@id=\’sortable\’]/li[6]\”)); 
//Thread.sleep(5000);
WebElement item3=driver.findElement(By.xpath(\”//*[@id=\’sortable\’]/li[7]\”));
WebElement item4=driver.findElement(By.xpath(\”//*[@id=\’sortable\’]/li[5]\”));
Thread.sleep(5000);
act.dragAndDrop(item1, item2).dragAndDrop(item4, item3).build().perform();

Pallavi Gadale Staff answered 5 years ago

5.AutoComplete
Actions act =new Actions(driver);
driver.get(\”http://jqueryui.com\”);
WebElement autocomplete = driver.findElement(By.xpath(\”//*[@id=\’sidebar\’]/aside[2]/ul/li[2]/a\”));autocomplete.click();
WebElement ComboBox = driver.findElement(By.xpath(\”//*[@id=\’content\’]/div[1]/ul/li[4]/a\”));ComboBox.click();
driver.switchTo().frame(0);
WebElement text_box = driver.findElement(By.xpath(\”/html/body/div[1]/span/input\”)); 
text_box.sendKeys(\”J\”);
List<WebElement> li= driver.findElements(By.className(\”ui-menu-item\”));  for(WebElement list :li) 
{      
    if(list.getText().equals(\”Java\”))        
   {              
           list.click();        
   }                 
}  

Pallavi Gadale Staff answered 5 years ago

6.Menu:
Actions act=new Actions(driver);
driver.get(\”http://jqueryui.com/menu/\”);
driver.switchTo().frame(0);
act.moveToElement(driver.findElement(By.xpath(\”//*[@id=\’ui-id-4\’]\”))).perform();Thread.sleep(3000); 
act.moveToElement(driver.findElement(By.xpath(\”//*[@id=\’ui-id-6\’]\”))).click().perform(); 
Thread.sleep(3000);  

Pallavi Gadale Staff answered 5 years ago

7.Slider:
Actions act =new Actions(dr);
driver.get(\”http://jqueryui.com/slider/#colorpicker\”);
driver.switchTo().frame(0);
WebElement source=driver.findElement(By.xpath(\”//*[@id=\’green\’]/span\”));
act.clickAndHold(source).moveByOffset(30,0).release().build().perform();//move to forward direction Thread.sleep(2000);
act.clickAndHold(source).moveByOffset(-30,0).release().build().perform(); // move to backward direction
Thread.sleep(5000);
driver.quit();   

Pallavi Gadale Staff answered 5 years ago

8.CheckboxRadio:
Actions act=new Actions(driver);
driver.switchTo().frame(0);
WebElement radioButton=driver.findElement(By.xpath(“//span[@class=’ui-checkboxradio-icon ui-corner-all ui-icon ui-icon-background ui-icon-blank’]”));
act.click(radioButton).perform();
Thread.sleep(1000);

WebElement checkbox=driver.findElement(By.xpath(“//label[@class=’ui-checkboxradio-label ui-corner-all ui-button ui-widget’]”));
act.click(checkbox).perform();
Thread.sleep(3000);
driver.quit();

Pallavi Gadale Staff answered 5 years ago

9.Selectmenu:
Actions act=new Actions(driver);
driver.get(“http://jqueryui.com/selectmenu/#product-selection&#8221;);
driver.switchTo().frame(0);
//first SelectMenu
act.moveToElement(driver.findElement(By.xpath(“//span[@class=’ui-selectmenu-icon ui-icon ui-icon-triangle-1-s’]”))).click().perform();
Thread.sleep(3000);
act.moveToElement(driver.findElement(By.xpath(“//div[@id=’ui-id-2′]”))).click().perform();
Thread.sleep(2000);

//second SelectMenu
act.moveToElement(driver.findElement(By.xpath(“//span[@id=’color-button’][1]”))).click().perform();
Thread.sleep(2000);
act.moveToElement(driver.findElement(By.xpath(“//div[@id=’ui-id-7′]”))).click().perform();
 

Pallavi Gadale Staff answered 5 years ago

10:DatePicker:
Actions act=new Actions(driver);
driver.get(“http://jqueryui.com/datepicker/&#8221;);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.switchTo().frame(0);
WebElement SelectDate=driver.findElement(By.xpath(“//*[@class=’hasDatepicker’]”));

SelectDate.click();
String ExpMonth=”sepetember 2019″;

String currMonth=driver.findElement(By.xpath(“//span[@class=’ui-datepicker-month’]”)).getText();

if(ExpMonth.equals(currMonth))
{
System.out.println(“Month is already selected”);
}
else
{
for(int i=1;i<8;i++)
{
driver.findElement(By.xpath(“//span[@class=’ui-icon ui-icon-circle-triangle-e’]”)).click();
Thread.sleep(1000);
currMonth=driver.findElement(By.xpath(“//span[@class=’ui-datepicker-month’]”)).getText();
if(ExpMonth.equals(currMonth))
{
System.out.println(“month selected”);
break;
}
}
}
Thread.sleep(1000);
WebElement date=driver.findElement(By.xpath(“//tr[5]/td[2]”));
act.moveToElement(date).click().build().perform();
thread.sleep(1000);
driver.quit();

}
}

Pallavi Gadale Staff answered 5 years ago

11.ControlGroup
driver.get(“http://jqueryui.com/controlgroup/&#8221;);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
Actions act=new Actions(driver);
driver.switchTo().frame(0);
act.moveToElement(driver.findElement(By.xpath(“//span[@id=’car-type-button’]”))).click().build().perform();
Thread.sleep(1000);
WebElement select=driver.findElement(By.xpath(“//div[@id=’ui-id-5′]”));
act.click(select).perform();
//radioButton
act.moveToElement(driver.findElement(By.xpath(“//label[1][@class=’ui-button ui-widget ui-checkboxradio-radio-label ui-checkboxradio-label ui-controlgroup-item’]”))).click().perform();
Thread.sleep(2000);
//checkbox
WebElement checkbox=driver.findElement(By.xpath((“//label[3][@for=’insurance’]”)));
act.moveToElement(checkbox).click(checkbox).build().perform();
Thread.sleep(1000);
act.moveToElement(driver.findElement(By.xpath(“//input[@id=’horizontal-spinner’]”))).click().sendKeys(“3”).perform();
Thread.sleep(2000);

act.moveToElement(driver.findElement(By.xpath(“//button[@class=’ui-widget ui-controlgroup-item ui-button ui-corner-right’]”))).click().perform();
Thread.sleep(3000);
driver.quit();