MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / promptPage

Method promptPage

java/test/org/openqa/selenium/AlertsTest.java:70–87  ·  view source on GitHub ↗
(String defaultText)

Source from the content-addressed store, hash-verified

68 }
69
70 private String promptPage(String defaultText) {
71 return appServer.create(
72 new Page()
73 .withTitle("Testing Prompt")
74 .withScripts(
75 "function setInnerText(id, value) {",
76 " document.getElementById(id).innerHTML = '<p>' + value + '</p>';",
77 "}",
78 defaultText == null
79 ? "function displayPrompt() { setInnerText('text', prompt('Enter something'));"
80 + " }"
81 : "function displayPrompt() { setInnerText('text', prompt('Enter something', '"
82 + defaultText
83 + "')); }")
84 .withBody(
85 "<a href='#' id='prompt' onclick='displayPrompt();'>click me</a>",
86 "<div id='text'>acceptor</div>"));
87 }
88
89 @Test
90 void testShouldBeAbleToOverrideTheWindowAlertMethod() {

Calls 4

withBodyMethod · 0.80
withScriptsMethod · 0.80
withTitleMethod · 0.80
createMethod · 0.65

Tested by

no test coverage detected