Jump to content

Webdriver: click on button with changing id


Recommended Posts

Hi Dan,

I don't know if the question is ok here:ย 

<button onclick="apex.submit({request:'START',validate:true});" class="t-Button t-Button--red " type="button" id="B4231223432461794"><span class="t-Button-label">Starten</span></button>

How can I click this button?

Link to comment
Share on other sites

  • Moderators

ย 

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hi @HJL,

the answer of Dan is "almost" correct (sorry @Danp2). I strongly believe you have to go one level deeper, into the span tag.

//button/span[contains(text(), 'Starten')]

In case the click still does not work, you should go back to the "parent" by this:

//button/span[contains(text(), 'Starten')]/parent::*

So you ensures you're find the correct element (by text) and do the click on the parent (button) which can receive the click event.

--------------------

For the future, in case you have similar questions:
Please provide a wider snippet of the DOM structure where your target element lives.
Then it would be simpler for us to show what is ment by the xpath-axis ancestor ๐Ÿค for example.

Best regards
Sven

Edited by SOLVE-SMART

Stay innovative!

Spoiler

๐ŸŒย Au3Forums

๐ŸŽฒ AutoIt (en) Cheat Sheet

๐Ÿ“Š AutoIt limits/defaults

๐Ÿ’Ž Code Katas: [...] (comming soon)

๐ŸŽญ Collection of GitHub users with AutoIt projects

๐Ÿžย False-Positives

๐Ÿ”ฎย Me on GitHub

๐Ÿ’ฌย Opinion about new forum sub category

๐Ÿ“‘ย UDF wiki list

โœ‚ย VSCode-AutoItSnippets

๐Ÿ“‘ย WebDriver FAQs

๐Ÿ‘จโ€๐Ÿซย WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...