▼ <HTML>
|
1
2
3
4
5
|
<select class="graySelect" name="sch_bub_nm" id="sch_bub_nm"
title="Case Number" onchange="onChangeBub();">
<option value="000100">Case1</option>
<option value="000200">Case2</option>
<option value="000201">Case3</option>
|
cs |
▼ <python_sol 1>
Select 를 사용해야합니다 드롭 다운 값을 가져옵니다. 값을 선택할 수있는 3 가지 옵션이 있습니다.
|
1
2
3
4
5
|
from selenium.webdriver.support.select import Select
select=Select(driver.find_element_by_id("sch_bub_nm"))
select.select_by_index(1) #select index value
select.select_by_visible_text("Case2") # select visible text
select.select_by_value("000201") # Select option value
|
cs |
▼ <python_sol 2>
상호 작용하려면 선택 요소를 만들어야합니다.
|
1
2
3
|
from selenium.webdriver.support.ui import Select
select = Select(driver.find_element_by_css_selector('#sch_bub_nm'))
select.select_by_index(1) # Choose the position you want
|
cs |
'IT 인터넷 소소한 팁' 카테고리의 다른 글
| [python] 오류 부분을 나타내는 빨간색 물결무늬 안보이는 경우, 보이게 하는 방법 (0) | 2020.12.14 |
|---|---|
| [Arduino] 아두이노 시작하기 - 스케치 (sketch) 설치부터 실행까지 (1) | 2020.12.14 |
| [python] AttributeError: 'list' object has no attribute 'click' 에러 해결 방법 (1) | 2020.12.01 |
| [구글 크롬] 이전 페이지 돌아가기 단축키 변경, 마우스 제츠처 사용... (0) | 2020.11.29 |
| [구글 크롬] 이전 페이지 돌아가기 단축키 변경, 백스페이스로 변경... (0) | 2020.11.29 |