0

For the html source code found at the bottom

driver.find_element_by_id('cashAccount1').click()

works just find. But if I try

driver.find_element_by_id('cashAccount2').click()

the code moves on to the next line without successfully clicking the element. I know it is finding the element because I'm not getting an error and I did a simple 'if' statement to test it. Does anyone know what could be going on here? Thank you very much for your help.

<tr valign="bottom">
        <th id="cashAccount1" scope="row" headers="cashAccountNameNumber" class="firstCol text rowhead">...</th>
        <td id="cashAvailBal1" headers="cashAccount1 cashAvailableBalance" class="amount">...</td>
        <td id="RelatedActivities1" headers="cashAccount1 cashRelatedActivities" class="btlRelatedActivities">...</td>
</tr>
<tr valign="bottom">
        <th id="cashAccount2" scope="row" headers="cashAccountNameNumber" class="firstCol text rowhead">...</th>
        <td id="cashAvailBal2" headers="cashAccount2 cashAvailableBalance" class="amount">...</td>
        <td id="RelatedActivities2" headers="cashAccount2 cashRelatedActivities" class="btlRelatedActivities">...</td>
</tr>

1 Answer 1

1
wait = WebDriverWait(driver, 10)
account = wait.until(expectedCondition.presence_of_element_located((By.ID, "cashAccount2")))

driver.execute_script("arguments[0].click();", account)

where expectedCondition is imported as:

from selenium.webdriver.support import expected_conditions as expectedCondition

Hope it helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.