This file contains 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
#It will be skipped when adding an addopts option in pytest.ini file -k "not 06" | |
def test_06(browser): | |
browser.get("https://www.lambdatest.com/selenium-playground/simple-form-demo") | |
assert browser.title == "Selenium Grid Online | Run Selenium Test On Cloud" |
This file contains 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
[pytest] | |
addopts = -k "not 06" |
This file contains 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
package pages.htmlelements; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.JavascriptExecutor; | |
import org.openqa.selenium.SearchContext; | |
import org.openqa.selenium.WebElement; | |
import static setup.DriverManager.getDriver; | |
public class HomePage { |
This file contains 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
public class ShadowRootTests extends BaseTest { | |
@BeforeClass | |
public void navigateToWebsite() { | |
getDriver().get("https://www.htmlelements.com/demos/menu/shadow-dom/index.htm"); | |
} | |
@Test | |
public void testFileMenuShadowRootElement() { | |
final HomePage homePage = new HomePage(); |
This file contains 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
@Test | |
public void testEditMenuShadowRootElement() { | |
getDriver().get("https://www.htmlelements.com/demos/menu/shadow-dom/index.htm"); | |
final HomePage homePage = new HomePage(); | |
assertEquals(homePage.getEditMenuText(), "Edit"); | |
} |
This file contains 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
public SearchContext expandRootElement(final WebElement element) { | |
return (SearchContext) ((JavascriptExecutor) getDriver()).executeScript( | |
"return arguments[0].shadowRoot", element); | |
} |
This file contains 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
@Test | |
public void testNewMenuShadowRootElement() { | |
getDriver().get("https://www.htmlelements.com/demos/menu/shadow-dom/index.htm"); | |
final HomePage homePage = new HomePage(); | |
assertEquals(homePage.getNewMenuText(), "New"); | |
} |
This file contains 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
public String getNewMenuText() { | |
openFileMenu(); | |
return fileMenu().findElement(By.cssSelector(".smart-menu-drop-down div smart-menu-item.smart-element")) | |
.getAttribute("label"); | |
} |
This file contains 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
@Test | |
public void testFileMenuShadowRootElement() { | |
getDriver().get("https://www.htmlelements.com/demos/menu/shadow-dom/index.htm"); | |
final HomePage homePage = new HomePage(); | |
assertEquals(homePage.getFileMenuText(), "File"); | |
} |
This file contains 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
public WebElement fileMenu() { | |
final WebElement shadowHost = getDriver().findElement(By.cssSelector(".smart-ui-component")); | |
final SearchContext shadowRoot = shadowHost.getShadowRoot(); | |
return shadowRoot.findElement(By.cssSelector(".smart-element .smart-menu-main-container .smart-element")); | |
} |
NewerOlder