セレンのwebdriverを使用してルータの設定を自動化しようとしています。以下はルータのページのhtmlです:セレンのwebdriverの自動化中に空のページapply.cgi
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="">
<head>
<body onunload="return unload_body();" onload="initial();">
<div id="TopBanner">
<div id="Loading" class="popup_bg">
<div id="hiddenMask" class="popup_bg">
<iframe id="hidden_frame" height="0" frameborder="0" width="0" name="hidden_frame">
<form target="hidden_frame" action="/start_apply2.htm" name="autochannelform" method="post">
<form target="hidden_frame" action="/start_apply2.htm" name="form" method="post">
<input type="hidden" value="RT-N66U" name="productid">
<input type="hidden" value="" name="wan_route_x">
<input type="hidden" value="1" name="wan_nat_x">
<input type="hidden" value="Advanced_Wireless_Content.asp" name="current_page">
<input type="hidden" value="Advanced_Wireless_Content.asp" name="next_page">
<input type="hidden" value="0" name="modified">
<input type="hidden" value="apply_new" name="action_mode">
<input type="hidden" value="restart_wireless" name="action_script">
<input type="hidden" value="10" name="action_wait">
<input id="preferred_lang" type="hidden" value="EN" name="preferred_lang">
<input type="hidden" disabled="" value="US" name="wl_country_code">
<input type="hidden" value="3.0.0.4" name="firmver">
<input type="hidden" value="" name="wps_mode">
<input type="hidden" value="" name="wps_config_state">
<input type="hidden" disabled="" value="" name="wlc_ure_ssid_org">
<input type="hidden" value="" name="wl_key1_org">
<input type="hidden" value="" name="wl_key2_org">
<input type="hidden" value="" name="wl_key3_org">
<input type="hidden" value="" name="wl_key4_org">
<input type="hidden" value="" name="wl_phrase_x_org">
<input type="hidden" readonly="1" value="" name="x_RegulatoryDomain" size="15" maxlength="15">
<input type="hidden" value="off" name="wl_gmode_protection">
<input type="hidden" value="on" name="wl_wme">
<input type="hidden" value="0" name="wl_mode_x">
<input type="hidden" value="-1" name="wl_nmode">
<input type="hidden" value="1" name="wl_nmode_x_orig">
<input type="hidden" value="" name="wl_nctrlsb_old">
<input type="hidden" value="" name="wl_key_type">
<input type="hidden" value="" name="wl_channel_orig">
<input type="hidden" value="" name="wl_chanspec">
<input type="hidden" value="0" name="wl_wep_x_orig">
<input type="hidden" value="0" name="wl_optimizexbox">
<input type="hidden" value="-1" name="wl_subunit">
<input type="hidden" value="" name="acs_dfs">
<input type="hidden" value="0" name="acs_band1">
<table class="content" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td width="17"> </td>
<td width="202" valign="top">
<td valign="top">
<div id="tabMenu" class="submenuBlock">
<table cellspacing="0" cellpadding="0" border="0" align="left" width="98%">
<tbody>
<tr>
<td align="left" valign="top">
<table id="FormTitle" class="FormTitle_firefox" cellspacing="0" cellpadding="4" border="0" width="760px" style="height: 838px;">
<tbody>
<tr>
<td bgcolor="#4D595D" valign="top">
<div> </div>
<div class="formfonttitle">Wireless - General</div>
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px">
<div class="formfontdesc">Set up the wireless related information below.</div>
<table id="WLgeneral" class="FormTable" cellspacing="0" cellpadding="4" border="1" align="center" width="99%">
<tbody>
<tr id="wl_unit_field">
<th>Frequency</th>
<td>
<select class="input_option" onchange="_change_wl_unit(this.value);" name="wl_unit">
<option class="content_input_fd" selected="" value="0">2.4GHz</option>
<option class="content_input_fd" value="1">5GHz</option>
</select>
</td>
</tr>
<tr>
<tr>
<tr>
<tr id="wl_bw_field">
<tr>
<tr id="wl_nctrlsb_field">
<tr>
<tr>
<tr>
<tr style="display: none;">
<tr style="display: none;">
<tr style="display: none;">
<tr style="display: none;">
<tr style="display: none;">
<tr style="display: none;">
<tr style="display: none;">
<tr style="display:none">
<tr>
</tbody>
</table>
<div class="apply_gen">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
<td align="center" width="10" valign="top"></td>
</tr>
</tbody>
</table>
<div id="footer">
</form>
</body>
</html>
"周波数"ドロップダウンボックスから "5GHz"オプションを選択します。以下は、これをやっているコードです:
self.browser_driver.get(self.base_url)
self.browser_driver.find_element_by_id("option_str1").click()
time.sleep(1)
Select(self.browser_driver.find_element_by_css_selector("select[name=\"wl_unit\"]")).select_by_visible_text("5GHz")
time.sleep(10)
self.browser_driver.close()
しかし、すぐに5GHz
オプションがドロップダウンメニューから選択されるように私はアドレスrouter_ip/apply.cgi
で空白のページを取得します。私はこのウェブページで次のメッセージを見る。
"router_ip"ページが機能していません "router_ip"はデータを送信しませんでした。 ERR_EMPTY_RESPONSE
この問題を解決する方法を教えてください。ルータの手動設定中にこの問題は発生しません。
なるほど、そのselect要素は無視されている...それはそれは引数に選ばれた値を使用すると仮定していますが方法がありますように見える、とのon_change属性かのようですエラーメッセージは、設定されていないことを示しています。 –
これはドロップダウンボックスから値を選択した後にクリックする適用ボタンのhtmlです: