@throws Exception if the test fails
()
| 131 | * @throws Exception if the test fails |
| 132 | */ |
| 133 | @Test |
| 134 | public void click() throws Exception { |
| 135 | final String htmlContent = DOCTYPE_HTML |
| 136 | + "<html><body>\n" |
| 137 | + " <form id='form1'>\n" |
| 138 | + " <select name='select1' id='select1'>\n" |
| 139 | + " <option id='option1'>Option1</option>\n" |
| 140 | + " <option id='option2' selected>Number Two</option>\n" |
| 141 | + " </select>\n" |
| 142 | + "</form></body></html>"; |
| 143 | final HtmlPage page = loadPage(htmlContent); |
| 144 | |
| 145 | final HtmlOption option1 = page.getHtmlElementById("option1"); |
| 146 | assertFalse(option1.isSelected()); |
| 147 | option1.click(); |
| 148 | assertTrue(option1.isSelected()); |
| 149 | option1.click(); |
| 150 | assertTrue(option1.isSelected()); |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * @throws Exception if the test fails |
nothing calls this directly
no test coverage detected