我有以下html:
<select id="80211Mode_5" onchange="ChangeWidthList('5')" name="80211Mode_5" sb="74332008" style="display: none;">
<option value="802.11a">802.11a only</option>
<option value="802.11n">802.11n only</option>
<option value="802.11an">Mixed 802.11a/n</option>
<option value="802.11ac">802.11ac only</option>
<option value="802.11nac">Mixed 802.11n/ac</option>
<option value="802.11anac">Mixed 802.11a/n/ac</option>
</select>
我想遍历所有下拉选项。我可以从下拉框中选择除802.11n
以外的所有选项。
当我尝试选择802.11n
时,我收到ElementNotVisibleException exception
。来自html 802.11n
看起来只是可见的。为什么我无法选择802.11n
选项,特别是以下代码:
def dlink_change_channel(self, channel):
try:
# Change channel in Dlink router
self.login()
self.browser_driver.find_element_by_id("menu_Settings").click()
self.browser_driver.find_element_by_link_text("Wireless").click()
self.browser_driver.find_element_by_css_selector("#RADIO_5GHz > div.advButton").click()
self.browser_driver.execute_script("document.getElementsByClassName('sbOptions')[11].style.display='inline-block';")
self.browser_driver.execute_script("document.getElementsByClassName('sbOptions')[11].scrollIntoView();")
self.browser_driver.execute_script("document.getElementsByClassName('sbOptions')[11].click();")
channel_xpath = "//a[@href="+"\'"+channel+"\'"+"]"
print channel_xpath
time.sleep(1)
self.browser_driver.find_element_by_xpath(channel_xpath).click()
time.sleep(1)
self.browser_driver.find_element_by_id("Save_btn").click()
time.sleep(1)
self.browser_driver.execute_script("document.getElementById('sumbit_CheckData').click();")
time.sleep(20)
self.browser_driver.find_element_by_id("Confirm_btn").click()
time.sleep(1)
self.browser_driver.close()
我正在从另一个函数传递channel
到dlink_change_channel
功能(我从循环中逐个传递802.11a
,802.11n
等等)
答案 0 :(得分:-1)
以下代码正在运行:
postsRepository.GetByAuthor("Bob").GetPage(5, 10);