java - How to detect web based popup such as the one Google Play store is using with Selenium Webdriver? -
example: go playstore app
permissions , click link (view details)
web based (javascript activate) popup.
how detect it?
since not ordinary web based or window pop up, doesn't detect @ all.
pcontent = driver.switchto().activeelement().findelement(by.classname("model-dialog")); location = pcontent.findelement(by.xpath("//bucket-description[text(),'precise location (gps , network-based]")).gettext(); system.out.println(location);
if know how detect selenium webdriver, please help!
thank in advance!
idk how code executed.it full of bugs
1.there no such class model-dialog
modal-dialog
.please copy paste html or cross check value at-least once.
2.by.xpath("//bucket-description[text(),'precise location (gps , network-based]")
.is xpath.read xpath start creating once
3.that not popup.it's normal element that's hidden inside dom.read webdriverwait , expectedconditions , see how check visibility of element
4.why want find element it's text , printing it's text. doesn't make sense
well here's full code reference.it works prefectly
webdriver driver = new firefoxdriver(); driver.get("https://play.google.com/store/apps/details?id=com.facebook.orca"); webelement permission = driver.findelement(by.classname("id-view-permissions-details")); permission.click(); webdriverwait wait = new webdriverwait(driver, 10); webelement modalpopup = driver.findelement(by.classname("modal-dialog")); wait.until(expectedconditions.visibilityof(modalpopup)); string xpath = "//ul[@class='bucket-description']//li[text()='precise location (gps , network-based)']"; webelement whattheheck = driver.findelement(by.xpath(xpath)); system.out.println(whattheheck.gettext()); driver.quit();
Comments
Post a Comment