Skip to content
Advertisement

Able to Toggle to Full Screen in a MAP but not able to minimize it

Able to Toggle to Full Screen in a MAP but not able to minimize it

This is my Xpath for both Maximize and Min :

WebElement togglefullscreen = driver.findElement(By.xpath("//button[contains(@title,'Toggle fullscreen view') and contains(@style,'position: absolute')]/img[1]"));
//maximizing the map
builder.moveToElement(togglefullscreen).click().perform();


//minimizing the Map
builder.moveToElement(togglefullscreen).click().perform(); = this is the place where it is not minimizing...

My Map is similar to the Map given in the link where the click here

HTML: -<button draggable="false" aria-label="Toggle fullscreen view" title="Toggle fullscreen view" type="button" class="gm-control-active gm-fullscreen-control" style="background: none rgb(255, 255, 255); border: 0px; margin: 10px; padding: 0px; text-transform: none; appearance: none; position: absolute; cursor: pointer; user-select: none; border-radius: 2px; height: 40px; width: 40px; box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px; overflow: hidden; top: 0px; right: 0px;"><img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2018%2018%22%3E%3Cpath%20fill%3D%22%23666%22%20d%3D%22M0%200v6h2V2h4V0H0zm16%200h-4v2h4v4h2V0h-2zm0%2016h-4v2h6v-6h-2v4zM2%2012H0v6h6v-2H2v-4z%22/%3E%3C/svg%3E" alt="" style="height: 18px; width: 18px;"><img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2018%2018%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M0%200v6h2V2h4V0H0zm16%200h-4v2h4v4h2V0h-2zm0%2016h-4v2h6v-6h-2v4zM2%2012H0v6h6v-2H2v-4z%22/%3E%3C/svg%3E" alt="" style="height: 18px; width: 18px;"><img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2018%2018%22%3E%3Cpath%20fill%3D%22%23111%22%20d%3D%22M0%200v6h2V2h4V0H0zm16%200h-4v2h4v4h2V0h-2zm0%2016h-4v2h6v-6h-2v4zM2%2012H0v6h6v-2H2v-4z%22/%3E%3C/svg%3E" alt="" style="height: 18px; width: 18px;"></button>

Any leads on this …

Advertisement

Answer

I think all it needs is basically an explicit waits in combination with worst explicit wait which is Thread.sleep(4000);. to the above mentioned link, I could do maximize and minimize by using the below code :-

driver.manage().window().maximize();
driver.get("http://beta.findtoilet.dk/?term=2&lat=55.678937&lng=12.575738&zoom=15&maptype=roadmap");
WebDriverWait wait = new WebDriverWait(driver, 30);
Thread.sleep(4000);
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("button[class*='gm-fullscreen']"))).click();
Thread.sleep(4000);
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("button[class*='gm-fullscreen']"))).click();
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement