<span id=":of" class="gO aQY" data-tooltip="Select Contacts" aria-label="To - Select Contacts" role="link" tabindex="1">To</span>
셀레늄 webdriver에서 요소를 찾는 방법은 여기에서 id가 시간을 변경할 수 있습니다. 그래서id가 시간을 변경하는 경우 셀렌 웹 드라이버에서 요소 찾기
<span id=":of" class="gO aQY" data-tooltip="Select Contacts" aria-label="To - Select Contacts" role="link" tabindex="1">To</span>
셀레늄 webdriver에서 요소를 찾는 방법은 여기에서 id가 시간을 변경할 수 있습니다. 그래서id가 시간을 변경하는 경우 셀렌 웹 드라이버에서 요소 찾기
는 XPath는에 의해 그것을 가져 오기 "에-연락처 선택"아리아 라벨에 의해 위치해야합니다
//span[@aria-label="To - Select Contacts"]
또한 사용할 수 있습니다
//span[@data-tooltip = 'Select Contacts']
CSS 선택은이 XPath는 내 좋아하는 선택. ID를 사용하지 않고 요소를 찾기 위해 사용할 수있는 속성은 매우 다양합니다.
이 읽어 보시기 바랍니다 : 당신은 CSS 선택기를 사용할 수 있습니다 http://www.w3schools.com/cssref/css_selectors.asp
. Smth like this :
//If class name is permanent and there is single instance on the page
driver.findElement(By.Css(".gO aQY"))
//otherwise
driver.findElement(By.Css("span[aria-label='To - Select Contacts']"))
자세한 내용은 this 링크를 참조하십시오.