Search code examples
seleniumpopupalertframemousehover

How can I reach the elements of the appeared pop-up using selenium?


In the following ecommerce site "https://www.gittigidiyor.com/", I want to click on "giris yap" button using selenium java but the problem is whenever I hover the mouse to profile icon, this pop-up appears and i try to inspect the pop-up to see the element but nothing happened. Could you please help me how can i click the buttons of this pop-up. I tried by switching to alert/frame but it did not workopened login popup in the site


Solution

  • driver.get("https://www.gittigidiyor.com")
    driver.findElement(By.cssSelector("[title=\"Giriş Yap\"]")).click()
    WebDriverWait wait = new WebDriverWait(driver,30);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[data-cy=\"header-login-button\"]"))).click();
    

    To find the element use below technique:

    To search xpath of such dynamic elements use DOM break points:

    enter image description here

    And select break on subtree modification. Now all changes will break and pause the webpage rendering

    enter image description here

    Click resume execution or press f8 till your span gets displayed