HJL Posted March 11, 2024 Posted March 11, 2024 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?
Moderators SmOke_N Posted March 11, 2024 Moderators Posted March 11, 2024 ย 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.
Danp2 Posted March 11, 2024 Posted March 11, 2024 You need to find an xpath that doesn't rely on the id. Something like this could work -- //button[contains(text(), 'Starten')] You can also use an selector that finds an ancestor first and uses the ancestor to locate the ultimate target. Latest Webdriver UDF Release Webdriver Wiki FAQs
SOLVE-SMART Posted March 11, 2024 Posted March 11, 2024 (edited) 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 March 12, 2024 by SOLVE-SMART ==> AutoIt related: ๐ GitHub, ๐ Discord Server, ๐ Cheat Sheet 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)
Danp2 Posted March 11, 2024 Posted March 11, 2024 Hey Sven, You may be correct as I only skimmed the post and missed the span inside the button element. However, don't count my solution out just yet as it may work as-is. ๐ Dan SOLVE-SMART 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now