TransWikia.com

localizar modal

Stack Overflow en español Asked by Manuel Garcia on December 9, 2021

la duda es: cerrar la modal o que encuentre el texto dentro de la modal, debido a esto, podríamos rellenar futuros formularios dentro de una modal. La ruta de la prueba es est@: https://the-internet.herokuapp.com/entry_ad

        @Test
        public void navigate() throws InterruptedException {
            
            driver.get("https://the-internet.herokuapp.com/entry_ad");
            
            WebElement title = driver.findElement(By.xpath("(//h3)[1]"));
            assertEquals("Entry Ad", title.getText());
            System.out.println(title.getText());
            WebElement clickModal = driver.findElement(By.id("restart-ad"));
    //pulsamos para que muestre la modal
            clickModal.click();
            
        //String titleModal = 
//  js.executeScript("return document.getElementById('modal').style.display ='block';").toString();
          // localizo el texto del xpath
            WebElement titleModal = driver.findElement(By.xpath("((//h3)[2]"));
            System.out.println( titleModal.getText());
            Thread.sleep(5000);

            //driver.findElement(By.xpath("(//p)[5]")).click();
        }

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP