steinnes / bord

chromium/pyppeteer based dashboard runner
0 stars 0 forks source link

Idea: search for "TV mode" elements and click them once page has loaded #9

Open eirikur-grid opened 4 years ago

eirikur-grid commented 4 years ago

Both datadog and amplitude have TV modes. As far as I understand, the Amplitude TV mode cannot be enabled via querystring. It might be possible to automate the clicking of this TV-mode button. We could attempt a generic search for a clickable element mentioning 'TV' or we could extend the config, making it possible to specify a CSS selector or something similar that points to an element that should be clicked.

eirikur-grid commented 4 years ago

I've been able to verify that this is doable. Here's a simple function that loads a page and then clicks an element when it becomes available.

async def open_page(browser, url: str, click_selector: Optional[str]):
    page = await browser.newPage()
    await page.goto(url)
    if click_selector is not None:
        e = await page.waitFor(click_selector)
        await e.click()

I've tested it with the following selectors: