Unable to get expected output using action class | Selenium Forum
R
Rupa Posted on 10/07/2020
I have added explicit wait still iam not getting expeected output.




package widget;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class Slider {

	static WebDriver driver;
	public static void main(String[] args) throws Exception {
	
		driver=new ChromeDriver();
		driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
		driver.manage().window().maximize();
		driver.get("http://way2automation.com/way2auto_jquery/index.php");
		driver.findElement(By.xpath("//div[@class='fancybox-inner']//a")).click();
		driver.findElement(By.xpath("//div[@id='login']//input[@name='username']")).sendKeys("Rupa Basuthkar");
		driver.findElement(By.xpath("//div[@id='login']//input[@name='password']")).sendKeys("govinda");
		driver.findElement(By.xpath("//div[@id='login']//input[@value='Submit']")).click();
		Thread.sleep(2000);
		driver.findElement(By.xpath("//div[@class='linkbox margin-bottom-20'][2]/ul/li[5]")).click();
		driver.findElement(By.xpath("//div[@class='internal_navi']/ul/li")).click();
		WebElement select=driver.findElement(By.xpath("//iframe[@src='slider/defult1.html']"));
		driver.switchTo().frame(select);
		WebElement slider=driver.findElement(By.xpath("//div[@id='slider-range-max']"));
		Actions act=new Actions(driver);
		act.dragAndDropBy(slider, 50, 0).build().perform();
		Thread.sleep(2000);
		WebDriverWait wait=new WebDriverWait(driver, 20);
		wait.until(ExpectedConditions.visibilityOfAllElements(driver.findElement(By.xpath("//html//body//p"))));
		String amount=driver.findElement(By.xpath("//html//body//p")).getText();
		System.out.println(amount);
		System.out.println(driver.getTitle());
	}
}

A
Ashish Replied on 11/07/2020

Its running fine here.

Its scrolling and printing

What is the output which you are expecting


Related Posts