반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Uipath 설치방법
- 파이썬네이버부동산
- Element is not clickable at point
- UiPath
- Uipath 기초
- 왕초보 파이썬 실행
- pywinauto
- 네이버 로그인 영수증 해결
- 네이버매물크롤링
- vscode venv 설치
- 네이버부동산크롤링
- 파이썬 가상환경 설치
- 네이버커머스API
- 파이썬 네이버 로그인
- pywinauto 윈도우
- 파이썬 가상환경 설치방법
- pycdc.exe
- venv 설치
- 날짜 정규식
- pywinauto 윈도우제어
- pycdas.exe
- 파이썬 환경설정
- 커머스API
- Selenium 셀렉터잡기
- 네이버 로그인 하기
- uipath 입문
- 가상환경설치
- Python
- 네이버 로그인 캡챠해결
- selenium
Archives
- Today
- Total
콘솔워크
[selenium] XPATH로 두 개 이상의 텍스트가 일치하는 web element 찾는 법 본문
반응형
한 줄 요약
table 태그에서 tr을 찾아야 할 때 두 가지 이상의 텍스트로 자료를 찾아야 하는 상황이 나왔을 때 만들었다.
order_tr = driver.find_element(By.XPATH, f"//tr[./td[text()='{text1}'] and ./td[text()='{text2}']]")
각종 연산자들도 사용 가능 할 것으로 보임
특정 텍스트가 포함된 checkbox 찾기.
텍스트는 buyer와 phone 변수로 이루어져 있다.
크롬 콘솔창에서 찾는법
$x('//tr[./td[//span[contains(text(), "홍길동")]] and ./td//span[contains(text()[2], "010-1234-1234")]]')
셀레니움으로 찾는법
checkbox_for_buyer = driver.find_elements(
f'//tr[./td[//span[contains(text(), {buyer})]] and ./td//span[contains(text()[2], {phone})]]//input[@type="checkbox"]'
)
참고자료
https://stackoverflow.com/questions/1064968/how-to-use-xpath-contains-here
How to use XPath contains() here?
I'm trying to learn XPath. I looked at the other contains() examples around here, but nothing that uses an AND operator. I can't get this to work: //ul[@class='featureList' and contains(li, 'Model...
stackoverflow.com
https://www.javatpoint.com/xpath-operators
XPath Operators - javatpoint
XPath Operators for beginners and professionals with examples on absolute path, relative path, syntax, nodes, axes, operators, wildcard, predicate etc.
www.javatpoint.com
반응형
'프로그래밍 > python' 카테고리의 다른 글
dataframe 특정 칼럼의 이름 바꾸기 (0) | 2022.08.03 |
---|---|
[selenium] iframe 이동 관련 (0) | 2022.08.01 |
필요해서 만든 반올림 함수 (0) | 2022.07.27 |
[selenium] 새 창 (팝업) 발생 시 닫고 진행하기 (0) | 2022.07.26 |
파이썬 셀레니움 특정 텍스트가 포함된 태그 바로 옆 태그의 text 가져오기 (0) | 2022.07.26 |