Created
January 12, 2023 20:41
-
-
Save zetxek/5f702011aa63f44bbb28e4404fdac656 to your computer and use it in GitHub Desktop.
checking when google maps stopped shadow banned me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* To learn more about Playwright Test visit: | |
* https://www.checklyhq.com/docs/browser-checks/playwright-test/ | |
* https://playwright.dev/docs/writing-tests | |
*/ | |
const { expect, test } = require("@playwright/test") | |
test("check review number=466", async ({ page }) => { | |
const response = await page.goto( | |
process.env.ENVIRONMENT_URL || | |
"https://www.google.com/maps/contrib/114734617841208618721/reviews/@48.5315351,-6.6330518,5z/data=!3m1!4b1!4m3!8m2!3m1!1e1&hl=en" | |
) | |
await page.keyboard.press("PageDown") | |
await page.screenshot({ path: "initial.jpg" }) | |
try{ | |
console.log('Attempting to accept cookies') | |
const acceptBtn = await page.getByText('"Accept all') | |
if (await acceptBtn.count() > 0){ | |
console.log('Found cookies button') | |
page.click('text="Accept all"', { | |
timeout: 2 | |
}) | |
}else{ | |
console.log('Cookies button not found, skipping') | |
} | |
}catch(e){ | |
console.log('No cookies page -- skipping "Accept all"') | |
} | |
expect(response.status()).toBeLessThan(400) | |
await page.waitForSelector(".TiFmlb") | |
const reviewLocator = await page.locator(".TiFmlb") | |
const textContent = await reviewLocator.textContent(); | |
console.log(`Reviews text: ${textContent}`) | |
expect(reviewLocator).toContainText("466 reviews") | |
expect(reviewLocator).toContainText("98 ratings") | |
await page.screenshot({ path: "loaded.jpg" }) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment