Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML Select/Option bugs #148

Open
valfirst opened this issue Jul 6, 2016 · 1 comment
Open

HTML Select/Option bugs #148

valfirst opened this issue Jul 6, 2016 · 1 comment
Labels

Comments

@valfirst
Copy link
Contributor

valfirst commented Jul 6, 2016

HTML support drop down lists with multiple selections: http://www.w3schools.com/tags/att_select_multiple.asp.

But jBrowserDriver doesn't support this type of elements for now.

import static org.junit.Assert.assertEquals;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;

import com.machinepublishers.jbrowserdriver.JBrowserDriver;
import com.machinepublishers.jbrowserdriver.Settings;

public class Main
{
    public static void main(String[] args)
    {
        JBrowserDriver webDriver = new JBrowserDriver(Settings.builder().headless(false).build());
        webDriver.get("http://www.htmlcodetutorial.com/forms/_SELECT_MULTIPLE.html");
        Select select = new Select(webDriver.findElement(By.name("toppings")));
        select.selectByValue("mushrooms");
        select.selectByValue("onions");
        for (WebElement option : select.getAllSelectedOptions())
        {
            System.out.println(option.getText());
        }
        webDriver.close();
    }
}

The code above tries to select 2 options: mushrooms and onions, but result is tomatoes.

Looks like current logic in ElementServer supports only single-select

@hollingsworthd
Copy link
Owner

Thanks, @valfirst. Yes, I think that's the case. Also (unrelated to this except that it's the same area of code) I think there's a bug that if the zero-th option isn't selected originally, then the wrong option gets selected.

@hollingsworthd hollingsworthd changed the title Unable to select options in HTML multi-select HTML Select/Option bugs Jul 6, 2016
@hollingsworthd hollingsworthd added this to the Next milestone milestone Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants