@And("^i press enter key$")publicvoidi_press_enter_key()throwsThrowable{driver.findElement(By.id("gbqfq")).sendKeys(Keys.ENTER);}
How can wait until a element display or clickable.
1234567891011121314
@Then("^i should see at least (\\d+) results related to my search keyword$")publicvoidi_should_see_at_least_results_related_to_my_search_keyword(intamount)throwsThrowable{WebDriverWaitwait=newWebDriverWait(driver,10);wait.until(ExpectedConditions.elementToBeClickable(By.id("pnnext")));List<WebElement>results=driver.findElements(By.cssSelector("li.g"));assertThat(results.size()).isGreaterThan(amount);List<String>resultTexts=Lambda.extract(results,on(WebElement.class).getText());for(Stringtext:resultTexts){assertThat(text).containsIgnoringCase(keyword);}}