OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Clicking a button that has input attribute with Selenium

  • Thread starter Thread starter Maxime Bouhadana
  • Start date Start date
M

Maxime Bouhadana

Guest
Good morning !

I have recently come accross a problem trying to interact with an element on a page. I would like to click a button but while inspecting the page, the button appears as <input name="play" id="play_id" type="submit" class="bouton" value="value_id">

Though on the website it appears as a clickable button. Here is what I've tried so far :

Code:
play_btn = driver.find_element("id", "play_id")
play_btn.click()

Code:
try:
    play_btn = WebDriverWait(driver, 10).until(
        EC.element_to_be_clickable(("xpath", '//*[@id="play_id"]'))
    )
    play_btn.click()
except NoSuchElementException:
    print("Not Found.")
driver.implicitly_wait(0.5)

I have even tried to click on (x, y) coordinates with

Code:
actions = ActionChains(driver)
actions.move_by_offset(500, 1644).click().perform()

but none of this seems to be working !

I have also tried several solutions proposed in other similar topics around here of nothing seems to be working either.

Thanks !
<p>Good morning !</p>
<p>I have recently come accross a problem trying to interact with an element on a page. I would like to click a button but while inspecting the page, the button appears as <code><input name="play" id="play_id" type="submit" class="bouton" value="value_id"></code></p>
<p>Though on the website it appears as a clickable button.
Here is what I've tried so far :</p>
<pre class="lang-py prettyprint-override"><code>play_btn = driver.find_element("id", "play_id")
play_btn.click()
</code></pre>
<pre class="lang-py prettyprint-override"><code>try:
play_btn = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable(("xpath", '//*[@id="play_id"]'))
)
play_btn.click()
except NoSuchElementException:
print("Not Found.")
driver.implicitly_wait(0.5)
</code></pre>
<p>I have even tried to click on <code>(x, y</code>) coordinates with</p>
<pre class="lang-py prettyprint-override"><code>actions = ActionChains(driver)
actions.move_by_offset(500, 1644).click().perform()
</code></pre>
<p>but none of this seems to be working !</p>
<p>I have also tried several solutions proposed in other similar topics around here of nothing seems to be working either.</p>
<p>Thanks !</p>
 

Latest posts

D
Replies
0
Views
1
Damiano Miazzi
D
Top