반응형
<select name="pets" id="pet-select">
<option value="dog">Dog</option>
<option value="cat">Cat</option>
<option value="hamster">Hamster</option>
<option value="parrot">Parrot</option>
<option value="spider">Spider</option>
<option value="goldfish">Goldfish</option>
</select>
from selenium.webdriver.support.select import Select
select = Select(driver.find_element(By.NAME, 'pets'))
select.select_by_index(1)
select.select_by_visible_text('Cat')
select.select_by_value('hamster')
반응형
'프로그래밍 > python' 카테고리의 다른 글
[selenium] 입력 받은 텍스트가 포함된 web element 찾기 by xpath (0) | 2022.07.21 |
---|---|
숫자 나누기, 나머지 구하기, 그리고 divmod() (/, %, divmod) (0) | 2022.07.20 |
[selenium] 웹에서 파일을 다운 받은 후 이름을 변경하는 함수 (0) | 2022.07.18 |
파이썬 추상클래스 정리 (0) | 2022.07.18 |
str int 형변환 에러 invalid literal for int() with base 10:'' (0) | 2022.07.15 |