How to implement multiple object selection?

Hi guys!

Can’t find out how to emulate multiple objects selection. For example we got a gallery with pictures (where every picture is an individual test object in Katalon) and I want to select a few of them using Ctrl/Shift + Click. How can I emulate such an action? I’ve tried through the sendKeys function, but seemed to do something wrong.

Would be happy to get any help or example :slight_smile:

1 Like

Hi @yuliya.h

I am not sure can you emulate the entire action(sending a key combination along with mouse movements) but here’s a headsup for using sendKeys to send value for Ctrl, Shift and Click.

CONTROL = ‘\ue009’
SHIFT = ‘\ue008’

One way of using them would be,

WebElement.sendKeys(Keys.RETURN); //for typing Enter/Return
WebElement.sendKeys(Keys.CONTROL); //for typing Control key
WebElement.sendKeys(Keys.SHIFT); //for typing Shift key. 

Source for key implementations can be found at: https://seleniumhq.github.io/selenium/docs/api/py/webdriver/selenium.webdriver.common.keys.html

Let’s say you want to emulate a hotkey combination(ALT+SHIFT+Z), you would go something like

String hotKeyCombination = Keys.chord(Keys.ALT, Keys.SHIFT,"Z");
driver.findElement(By.tagName("randomTagName")).sendKeys(selectAll);

You might have to modify the above code a bit so that Katalon can run it. Let me know how it goes.

2 Likes

Thank you Jait!

Yeah I know how to send keys combination, but can’t understand how to use them along with mouse click.

1 Like

Forgot about using Selenium actions. Looks like I found a way:

https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/interactions/Actions.html#sendKeys-org.openqa.selenium.WebElement-java.lang.CharSequence…-

Anyway, thank you :slight_smile:

1 Like

Yep, was gonna mention. Good luck.

1 Like

So, in my case a quick solution looks like this:

2 Likes