http://www1.river.go.jp/cgi-bin/SrchSiteSui2.exe
I would like to automatically input the water system and observation items in this link using python selenium.
First of all, I tried the water system one by one, so I ran the following code.
from selenium import webdriver
from selenium.webdriver.support.ui import Select
import time
browser=webdriver.Edge(r'C:\Users\...\edgedriver_win64\msedgedriver.exe')
browser.get('http://www1.river.go.jp/cgi-bin/SrchSiteSui2.exe')
SUIKEI=browser.find_element_by_name('SUIKEI')
SUIKEI_select=Select(SUIKEI)
SUIKEI_select.select_by_visible_text('Fukuchi River')
However, the following error occurs:
NoSuchElementException: Message: no such element: Unable to locate element: {"method": "css selector", "selector": "[id="SUIKEI"]"}
When I checked with the developer tool,
<select name="SUIKEI" id="SUIKEI">
I don't think it's a problem, but how can I solve it?
Thank you for your cooperation.
If you look in the web browser's inspectors for the menu part where you enter the water system name and observation items, they are placed inside the FRAME
tag as follows:
<frame name="WSearch" id="WSearch" src="SrchSiteSui2.exe?MODE=1"scrolling="NO" marginwidth="1" marginheight="1" noresize="">
:
<table width="100%" cellspacing="0" cellpadding="1" border="1" bgcolor="#cccccc">
<tbody>
<tr>
<td width="70" value="middle" align="center" nowrap="">font size="2">water system name</font>>
<td width="320" value="middle" align="left" nowrap="">select name="SUIKEI" id="SUIKEI">
<option value="-1" selected="></option>
<option value="90331000">Fukuchi River
</option><option value="90332000">Shinagawa River
:
</option></select></td>
</table>
Therefore, specify the value of the src
attribute for the FRAME
tag.
##browser.get('http://www1.river.go.jp/cgi-bin/SrchSiteSui2.exe')
browser.get('http://www1.river.go.jp/cgi-bin/SrchSiteSui2.exe?MODE=1')
© 2024 OneMinuteCode. All rights reserved.