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

Selecting comboBox items with quotation marks results in a parsing exception #220

Open
MTSym opened this issue Sep 7, 2022 · 1 comment
Assignees

Comments

@MTSym
Copy link

MTSym commented Sep 7, 2022

If you try to select a combo box containing quotation marks you will receive a javascript parsing exception because those quotation marks are not escaped.

Even if the input for comboBox.selectItem is escaped the resulting JS script is unescaped again.

Reproducer:

actionMenu(remoteRobot, "File").click();
actionMenuItem(remoteRobot, "Project Structure...").click();

var comboBox = remoteRobot.find(ComboBoxFixture.class, byXpath("//div[@class='JdkComboBox']"), Duration.ofSeconds(2));
comboBox.selectItem("18  java version \"18\"");
//comboBox.selectItemContains("java version");

Result which get sent:

ctx.get('fixture').selectItem("18  java version "18"")
@MTSym
Copy link
Author

MTSym commented Sep 22, 2022

Tried it with a workaround which seems fine for now.

var comboBox = remoteRobot.find(ComboBoxFixture.class, byXpath("//div[@class='JdkComboBox']"), Duration.ofSeconds(2));
comboBox.click();

var list = remoteRobot.find(JListFixture.class, byXpath("//div[@class='MyList']"), Duration.ofSeconds(2));
list.clickItem("18 ", false);

So instead of using selectItem or selectItemContains from the combobox fixture I click on it and grab the list fixture which appears. By using clickItem which internally uses clickItemAtIndex everything works as expected. Maybe the selectItem of the combobox can be changed to also use the index of the item instead of sending the string as JS

@nizienko nizienko self-assigned this Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants