Auto suggestive error | Selenium Forum
R
Rupa Posted on 29/05/2020

Iam not getting required output in search job and place.

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;

}
}
}
}

 


A
Ashish Replied on 03/06/2020

Please post the error screenshot as well.. so that its clear to us

If possible - if you can tell/highlight the line on which error is coming


Related Posts