파이썬과 자바 selenium 사용법 간단한 기능 비교 및 xpath 사용법
2018. 8. 8. 15:45
반응형
JAVA
driver.manage().window().maximize(); //브라우저 확장
Python
driver.maximize_window()
JAVA
Thread.sleep(500); //단위 ms
Python
import time #(import 필요)
time.sleep(0.5) # 단위 s
JAVA
Alert alert = driver.switchTo().alert(); //얼럿 창으로 스위칭
Python
alert = driver.switch_to_alert()
JAVA
alertText = alert.getText(); //얼럿 창 메시지 추출
Python
alertText = alert.text
JAVA
driver.find_element_by_id('user_id').sendKeys('id'); //id 요소 찾기와 입력값 채우기
Python
driver.find_element_by_id('user_id').send_keys('id')
JAVA
driver.quit();
Python
driver.close()
Python
driver.find_element_by_xpath('//*[@id="content"]/div/div[3]/button[2]').click() //xpath 클릭
표 출처 : https://wkdtjsgur100.github.io/selenium-xpath/
반응형
'지식메모 > Python' 카테고리의 다른 글
python 3.7.0 에서 pyside2를 설치하여 Qt Designer 설치하기 (2) | 2018.08.14 |
---|---|
파이썬에서 selenium으로 네이버 로그인 자동화하기 (0) | 2018.08.08 |
파이썬 TabError: inconsistent use of tabs and spaces in indentation 에러 해결 (Atom 에디터 옵션 설정) (0) | 2018.08.08 |
파이썬에서 selenium을 이용하여 크롬 브라우저 띄우기 (0) | 2018.08.07 |
android calabash apk is not signed with any of the available keystores 문제 해결을 위한 apk resign 하기 (0) | 2015.05.29 |