Unable to get expected output using action class | Selenium Forum
R
Rupa Posted on 11/07/2020
I have added explicit wait still iam not getting expeected output. In my output iam not able to see the no.of bedrooms after scrolling?




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 Thakur Replied on 12/07/2020

This is running fine

Slider is sliding

text is being read

What is the issue at your end?