▼ <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 |