0
나는 www.bigbasket.com의 검색 결과에 대한 툴팁 텍스트를 얻으려고하고 아래 코드Selenium WebDriver를 사용하여 툴팁 텍스트를 얻는 방법은 무엇입니까?
@FindAll({@FindBy(xpath="//*[contains(@id,'product')][not(contains(@style,'display:none'))]/div/span[2]/a")})
List<WebElement> lblProductName;
public String verifySearchResults(WebDriver browser, String productName){
System.out.println(lblProductName.size());
try{
Actions actions = new Actions(browser);
for(WebElement eachElement:lblProductName){
System.out.println(eachElement.getAttribute("href"));
actions.moveToElement(eachElement).perform();
//Actions action = new Actions(driver);
actions.moveToElement(eachElement).build().perform();
WebElement toolTipElement = browser.findElement(By.cssSelector(".uiv2-tool-tip-hover "));
System.out.println("Tooltip text is "+toolTipElement.getAttribute("textContent"));
}
}catch(Exception e){
System.out.println(e.getMessage());
}
return productName;
}
을 사용했다 그러나 위의 코드와 난 단지 도구 설명 텍스트를 얻을 수 있어요 첫 번째 검색 결과 모든 검색 결과의 도구 설명 텍스트를 가져 오는 방법을 알려주십시오. 1.을 따르지
수동 단계는 2. 클릭하여 도구 설명 텍스트
actions.moveToElement (각 요소) .perform(); // Actions action = new Actions (driver);'쓸모없는 것 같습니다. 거기에 오타가 있습니까? – nullpointer
지금까지 얻은 결과를 공유하십시오. 실제로 기대하고 계신 것 같습니다. – nullpointer