Skip to content

Commit

Permalink
[apps/browser] improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed Sep 10, 2024
1 parent 7f5bf7c commit c20f8a9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions apps/browser/siteuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@
browser = await pyppeteer.launch()
page = await browser.newPage()
Here is an example on the kind of code you can generate:
# find element with text donate and click it use '*' to support any element
button_with_xpath = await page.xpath('//*[contains(text(), "donate")]')
await button_with_xpath.click()
# set username to 'new value' with type() and evaluating JavaScript dynamically, type() preferred
await page.type('input[name="username"]', 'new value')
# scroll to bottom of page by evaluating arbitrary javascript
await page.evaluate('''() => {
window.scrollTo(0, document.body.scrollHeight);
}''')
---
At the beginning of the code, use print() to communicate what the code will do.
Only reply with a code block for python code.
"""
Expand Down

0 comments on commit c20f8a9

Please sign in to comment.