Matthias
Matthias

Reputation: 29

How to find the next/child button of a div and then click it in Power Automate Desktop with Jquery selector

I'm currently using Power Automate Desktop. I have the problem that need to find a div with content which must contains a specific number e.g. 000000588093. when this div is found, I need to find the button below it and click it.

I'm currently using this syntax, but it not working so far

div[Id="Servicenummer"]:eq(1).next('button')

or

div[Id="Servicenummer"]:eq(1) > button

This is the html tree for this problem:

<div><br>
     <div id="Müller">Name: Müller</div>
     <div>ID: 1</div>
     <div>Birthday:07.07.2010</div>
     <div id="Servicenummer">Servicenummer: 000000577537</div>
     <button >Download PDF ID=1</button>
     <br><br><br>
      <div id="Seemann">Name: 
      Seemann</div>
      <div>ID: 2</div>
      <div>Geburtsdatum: 03.04.1980</div>
      <div id="Servicenummer">Servicenummer: 000000588093</div>
      <button >Download PDF ID=2</button>
   </div>

neither of them works. I hope you can help!

Best regards

Matthias

Upvotes: 0

Views: 682

Answers (1)

Alex
Alex

Reputation: 10216

First, your html markup is invalid. Ids must be unique, you reuse Servicenummer as id.

The jQuery selector for your example would be:

$(':contains("Servicenummer: 000000577537")').next();

That would give you the <button> next to the element with text "Servicenummer: 000000577537".

Upvotes: 0

Related Questions