I am using Python headless browser library Pyppeteer. It's basically the same as Puppeteer (JS). So solutions which work on Puppeteer should work here too. I need a button to be clicked. Problem is that this button is dynamically generated and its id changes everytime:
Button
<button type="submit" class="btn btn-secondary" id="single_button5ea4a114318a96" title="">Upgrade Moodle database now</button>
Code
async def configure(self):
browser = await launch()
page = await browser.newPage()
await page.goto('mysite.example')
await asyncio.gather(
page.waitForSelector('button[title="Upgrade Moodle database now"]', timeout=60000),
page.click('button[title="Upgrade Moodle database now"]')
)
I could find that button from that part of its name which doesnt change single_button
but there are 3 more buttons which ids starting single_button
Other buttons in the page:
<button type="submit" class="btn btn-secondary" id="single_button5ea4a114318a95" title="">Cancel new installations (2)</button>
<button type="submit" class="btn btn-secondary" id="single_button5ea4a114318a93" title="">Cancel this installation</button>
<button type="submit" class="btn btn-secondary" id="single_button5ea4a114318a94" title="">Cancel this installation</button>
Two things which makes this button unique are its id last number and title It would be appreciated if you could help me how to hit this button by its title.
Thank you guys!