1.go to this URL :->http://wallethub.com/profile/test_insurance_company/
2.On the right part of the page, hover over the stars and click on the fifth star code should actually (1) do the hover and (2) make sure the stars inside get lit up when you hover over them, then (3) click on the fifth star.
The following doesn't work
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.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.openqa.selenium.interactions.Actions;
public class Wallethub2 {
/**
* @param args
*/
public static void main(String[] args) {
ProfilesIni prof = new ProfilesIni();
FirefoxProfile fp = prof.getProfile("sel");
WebDriver driver=new FirefoxDriver(fp);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("http://wallethub.com/profile/test_insurance_company/");
// Xpaths of 5 stars
String star1="//div[@class='wh-rating-choices-holder']/a[contains(@href, '#')][1]";
String star2="//div[@class='wh-rating-choices-holder']/a[contains(@href, '#')][2]";
String star3="//div[@class='wh-rating-choices-holder']/a[contains(@href, '#')][3]";
String star4="//div[@class='wh-rating-choices-holder']/a[contains(@href, '#')][4]";
String star5="//div[@class='wh-rating-choices-holder']/a[contains(@href, '#')][5]";
WebElement srating1=driver.findElement(By.xpath(star1));
WebElement srating2=driver.findElement(By.xpath(star2));
WebElement srating3=driver.findElement(By.xpath(star3));
WebElement srating4=driver.findElement(By.xpath(star4));
WebElement srating5=driver.findElement(By.xpath(star5));
Actions builder = new Actions(driver);
builder.moveToElement(srating1).build().perform();
builder.moveToElement(srating1).build().perform();
builder.moveToElement(srating2).build().perform();
srating3.click();
}
}