SeleniumHQ / htmlunit-driver

WebDriver compatible driver for HtmlUnit headless browser.
Apache License 2.0
255 stars 86 forks source link

Selenium 4 - Select - UnsupportedOperationException getDomAttribute #106

Closed RaHehl closed 2 years ago

RaHehl commented 3 years ago

Hi,

using Selenium 4 with the current htmlunit-driver snapshot i get a UnsupportedOperationException Exception using "Select":

Exception in thread "main" java.lang.UnsupportedOperationException: getDomAttribute
    at org.openqa.selenium.WebElement.getDomAttribute(WebElement.java:131)
    at org.openqa.selenium.support.ui.Select.<init>(Select.java:54)

This could could be reproduced by using the example from https://www.selenium.dev/documentation/support_packages/working_with_select_elements/

WebElement selectElement = driver.findElement(By.id("selectElementID"));
Select selectObject = new Select(selectElement);

In my case ById 1 and this html code:

  <html>
<head>
<title>Testapp</title>
</head>
<body>
<h1>Überschrift</h1>
  <form action="#"> 
    <select name="top5" id ="1"> 
      <option value="1">Entry1</option> 
      <option value="2">Entry2</option> 
      <option value="3">Entry3</option> 
      <option value="4">Entry4</option> 
      <option value="5">Entry5</option> 
    </select> 
    <select name="top5" id ="multiple" multiple="multiple"> 
      <option value="1" selected="selected">Entry1</option> 
      <option value="2">Entry2</option> 
      <option value="3">Entry3</option> 
      <option value="4">Entry4</option> 
      <option value="5" selected="selected">Entry5</option> 
    </select> 
  </form>
</body>
</html>
rbri commented 3 years ago

To make it a bit simpler for me can you please post a simple main method/class that reproduces you problem.

Tejareddy1 commented 3 years ago

@rbri, the same issue happening with the chrome browser as well. ?

java.lang.UnsupportedOperationException: getDomAttribute at org.openqa.selenium.WebElement.getDomAttribute(WebElement.java:131) at org.openqa.selenium.support.ui.Select.(Select.java:54)

rbri commented 3 years ago

please try 3.54.0-SNAPSHOT

rbri commented 2 years ago

fixed and released