Skip to content

Instantly share code, notes, and snippets.

@shihyu
Last active April 23, 2018 05:31
Show Gist options
  • Save shihyu/d41512962cb35dea2dd8c369bdb0154b to your computer and use it in GitHub Desktop.
Save shihyu/d41512962cb35dea2dd8c369bdb0154b to your computer and use it in GitHub Desktop.
Traceback (most recent call last):
File "test1.py", line 54, in <module>
select.select_by_visible_text("7")
File "/home/shihyu/anaconda3/lib/python3.6/site-packages/selenium/webdriver/support/select.py", line 120, in select_by_visible_text
self._setSelected(opt)
File "/home/shihyu/anaconda3/lib/python3.6/site-packages/selenium/webdriver/support/select.py", line 212, in _setSelected
option.click()
File "/home/shihyu/anaconda3/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "/home/shihyu/anaconda3/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "/home/shihyu/anaconda3/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/home/shihyu/anaconda3/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible: Element is not currently visible and may not be manipulated
(Session info: chrome=65.0.3325.181)
(Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux 4.13.0-38-generic x86_64)
<div class="styled-select">
<select name="channel_24" id="channel_24" onchange="ChangeWidthList('24')" sb="29464175" style="display: none;">
<option value="0">Auto</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
</select>
<div id="sbHolder_29464175" class="sbHolder" style="width:200px">
<a id="sbToggle_29464175" href="#" class="sbToggle sbToggleOpen"></a><a id="sbSelector_29464175" href="#" class="sbSelector" style="width:170px">5</a>
<ul id="sbOptions_29464175" class="sbOptions" style="width: 200px; display: block; top: 30px; max-height: 501.016px;">
<li><a href="0" rel="0" class="">自動</a></li>
<li><a href="1" rel="1" class="">1</a></li>
<li><a href="2" rel="2" class="">2</a></li>
<li><a href="3" rel="3" class="">3</a></li>
<li><a href="4" rel="4" class="">4</a></li>
<li><a href="5" rel="5" class="">5</a></li>
<li><a href="6" rel="6" class="">6</a></li>
<li><a href="7" rel="7" class="">7</a></li>
<li><a href="8" rel="8" class="">8</a></li>
<li><a href="9" rel="9" class="">9</a></li>
<li><a href="10" rel="10" class="">10</a></li>
<li><a href="11" rel="11" class="">11</a></li>
</ul>
</div>
</div>
select = Select(driver.find_element_by_name("channel_24"))
select.select_by_visible_text("7")
for op in select.options:
print(op.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment