Module18,dice.com | Selenium Forum
R
Rupa Posted on 28/05/2020

here is my code iam not geting expected output

 

package module18;

import java.util.List;
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.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;

public class Dice {

static WebDriver driver;

@Test
public void jobPortal() throws Exception{
String tool="selenium tester";
String location="New York State, USA";
driver=new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("https://www.dice.com/");
driver.findElement(By.xpath("//input[@placeholder='Job title, skills or company']")).sendKeys("Selenium");
Thread.sleep(2000);
selectValue(tool);
Thread.sleep(2000);
driver.findElement(By.xpath("//input[@placeholder='Location (zip, city, state)']")).sendKeys("New York");
Thread.sleep(2000);
selectValue(location);

}

public void selectValue(String selection) throws Exception{
List<WebElement>options=driver.findElements(By.xpath("//div[@class='ng-star-inserted']"));
System.out.println(options.size());
WebDriverWait wait=new WebDriverWait(driver, 20);
wait.until(ExpectedConditions.visibilityOfAllElements(options));
for(WebElement e:options){
System.out.println(e.getText());
if (e.getText().equals("selection")) {
Thread.sleep(2000);
Actions act=new Actions(driver);
act.click(e).build().perform();
break;

}
}
}
}

 


S
Support Team Replied on 28/05/2020

Whats the error in this

Please put screenshot of the issue as well


Related Posts