본문 바로가기

Python/Crawling

Selenium - xpath를 이용해, 동일한 상위 요소 아래에서 다른 하위 요소를 선택하는 방법(C#)

728x90
element = Driver.FindElement(By.XPath("//input[@class='x-input select2-offscreen' and contains(@name,'" + fieldName + "')]//preceding::div[1]/a/span[@class='select2-chosen']"));

[출처]

https://stackoverflow.com/questions/49702167/selenium-how-to-choose-another-child-element-under-the-same-parent-element-c

728x90

'Python > Crawling' 카테고리의 다른 글

Selenium - JavaScriptExecutor  (0) 2023.05.04
Selenium - xpath  (0) 2023.05.04
Selenium - 아래 또는 위로 스크롤하는 방법  (0) 2023.05.04
Selenium - Waits  (0) 2023.05.04
Web Driver & Selenium  (0) 2023.05.04