나는 페이지 요소에 포함되어 있으며 .getText()
매개 변수로 값을 검색 할 수있는 링크의 전체 텍스트를 가져오고 싶습니다. 문제는 페이지에 표시되는 부분 만 "..."다음에 나오는 것입니다. 셀레늄 (자바) 페이지에서 표시 요약에서 짧게 얻으십시오
.getText returns = "http://www.example.com/es_es/spa..."
what I need to get ="http://www.example.com/es_es/spain/legal-notice.html"
이
내가 요소를 찾을 수 있어요 HTML<a href="http://www.example.com/es_es/spain/legal-notice.html"
target="_blank">http://www.example.com/es_es/spa...</a>
, 단지 그것의 전체 텍스트를 검색 할 수 없습니다. 나는 .getAttribute("href")
을 시도했지만 returns "null"
입니다.
감사합니다.
WebElement hrefText=driver.findElement(By.xpath("//a[@href='http://www.example.com/es_es/spain/legal-notice.html']"));
String text_hrefText=hrefText.getAttribute("href");
System.out.println(text_hrefText);
를 해결 : 이제
,href
의 전체 텍스트를 검색하면 다음 코드 줄을 사용할 수 있습니다 때문이다. 고맙습니다. – fabik도움이 되니 기쁘다. – iamsankalp89