As part of an automated task software, I use Selenium with python to use the web. After some advancement I got stuck with a problem that I can't solve at all.
I would like to find a tag with Selenium to be able to select one of these options. It has an ID and a class. So I write:
select = driver.find_element(By.CLASS_NAME, "myselectclassname")
select.select_by_value('1')
select.click()
Unfortunately I get this error every time:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method": "css selector", "selector":".myselectclassname"}
(Session info: MicrosoftEdge=IP)
I searched all the help on google and they all tell me to put a delay before the element is found (as the search would be too fast before the web page is generated), so I try again another code with ID :
select= WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "theIDofmyselect"))
But after the 10s delay, an error is returned because of the time.
Can someone help me? I have python 3.10 and selenium 4.3.0
Update
The code is very loud so here is a summary part :
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<span class="blockedElement">
<select id="myselectid" class="myselectclassname" style="margin-top:3px;">
<option title="text_1" value="0" selected="selected">
t e xt1
</option>
<option title="text_2" value="1">
t ex t2
</option>