Mouse¶
Using the methods below, you can control and obtain information from the mouse.
Getting mouse coordinates¶
If you want to get the mouse coordinate, use the methods below to get the X and Y position of the mouse.
Moving to a coordinate¶
To move the mouse to a coordinate, use the method below.
Moving the mouse¶
If you want to move the mouse to an element, use the methods below.
You can move directly to an element or move to a position relative to the position of the found element or to a random position on the screen.
Note
The find()
is used to look for the element and collect its position. Click here for more information.
# Looking for the element on the page with the label 'SubmitForm'
if bot.find(label='SubmitForm', matching=0.97, waiting_time=10000):
# Moving directly to the element found.
bot.move()
# Moving to the position x=100 and y=200 relative to the element found.
bot.move_relative(x=100, y=200)
# Moving the mouse to a random position within a range x=100 and y=200.
bot.move_random(range_x=100, range_y=200)
// Looking for the element on the page with the label 'SubmitForm'.
if (find("SubmitForm", 0.97, 10000)) {
// Moving directly to the element found.
move();
// Moving to the position x=100 and y=200 relative to the element found.
moveRelative(100, 200);
}
// Moving the mouse to a random position within a range x=100 and y=200.
moveRandom(100, 200);
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm')) {
const center = this.state.center()
await desktopBot.moveMouse(center.x, center.y)
// Moving to the position x=100 and y=200 relative to the element found.
await desktopBot.moveRelative(100, 200)
}
// Moving the mouse to a random position within a range x=100 and y=200.
await desktopBot.moveRandom(100, 200)
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm')) {
const center: object = this.state.center()
await desktopBot.moveMouse(center?.x, center?.y)
// Moving to the position x=100 and y=200 relative to the element found.
await desktopBot.moveRelative(100, 200)
}
// Moving the mouse to a random position within a range x=100 and y=200.
await desktopBot.moveRandom(100, 200)
Clicking on a coordinate¶
If you need to click on a position on the screen use the method below.
Clicking on the element¶
If you want to click on the element, use the methods below.
You can click directly on the element or click on a relative position of the found element.
Note
The find()
is used to look for the element and collect its position. Click here for more information.
# 'SubmitForm' is the label of the element that will be clicked.
bot.click_on(label='SubmitForm')
# Looking for the element on the page with the label 'SubmitForm'.
if bot.find(label='SubmitForm', matching=0.9, waiting_time=10000):
# Clicking on the element found.
bot.click()
# Right click on the element found.
bot.right_click()
# Looking for the element on the page with the label 'SubmitForm'.
if bot.find(label='SubmitForm', matching=0.9, waiting_time=10000):
# Clicking on the position x=100 and y=200 relative to the element found.
bot.click_relative(x=100, y=200)
# Right-click on the position x=100 and y=200 relative to the element found.
bot.right_click_relative(x=100, y=200)
// 'SubmitForm' is the label of the element that will be clicked.
clickOn("SubmitForm");
// Looking for the element on the page with the label 'SubmitForm'.
if (find("SubmitForm", 0.97, 10000)) {
// Clicking on the element found.
click();
// Right click on the element found.
rightClick();
}
// Looking for the element on the page with the label 'SubmitForm'.
if (find("SubmitForm", 0.97, 10000)) {
// Clicking on the position x=100 and y=200 relative to the element found.
clickRelative(100, 200);
// Right click on the position x=100 and y=200 relative to the element found.
rightClickRelative(100, 200);
}
// 'SubmitForm' is the label of the element that will be clicked.
await desktopBot.clickOn('SubmitForm')
// Looking for the element on the page with the label 'SubmitForm'.
if (await bot.find('SubmitForm') !== null) {
// Clicking on the element found.
await desktopBot.click()
// Right click on the element found.
await desktopBot.click('right')
}
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm') !== null):
// Clicking on the position x=100 and y=200 relative to the element found.
await desktopBot.clickRelative(100, 200)
// Right click on the position x=100 and y=200 relative to the element found.
await desktopBot.clickRelative(100, 200, 'right')
// 'SubmitForm' is the label of the element that will be clicked.
await desktopBot.clickOn('SubmitForm')
// Looking for the element on the page with the label 'SubmitForm'.
if (await bot.find('SubmitForm') !== null) {
// Clicking on the element found.
await desktopBot.click()
// Right click on the element found.
await desktopBot.click('right')
}
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm') !== null):
// Clicking on the position x=100 and y=200 relative to the element found.
await desktopBot.clickRelative(100, 200)
// Right click on the position x=100 and y=200 relative to the element found.
await desktopBot.clickRelative(100, 200, 'right')
Double-click on the element¶
If you need to double-click on the element or double-click on a relative position of the element, use the methods below.
Note
The find()
is used to look for the element and collect its position. Click here for more information.
# Looking for the element on the page with the label 'SubmitForm'.
if bot.find(label='SubmitForm', matching=0.97, waiting_time=10000):
# Double click on the element found.
bot.double_click()
# Looking for the element on the page with the label 'SubmitForm'.
if bot.find(label='SubmitForm', matching=0.97, waiting_time=10000):
# Double-click on the position x=100 and y=200 relative to the element found.
bot.double_click_relative(x=100, y=200)
// Looking for the element on the page with the label 'SubmitForm'.
if (find("SubmitForm", 0.97, 10000)) {
// Double click on the element found.
doubleClick();
}
// Looking for the element on the page with the label 'SubmitForm'.
if (find("SubmitForm", 0.97, 10000)) {
// Double click on the position x=100 and y=200 relative to the element found.
doubleClickRelative(100, 200);
}
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm')){
// Double click on the element found.
await desktopBot.doubleClick()
}
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm')){
// Double click on the position x=100 and y=200 relative to the element found.
await desktopBot.doubleClickRelative(100, 200)
}
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm')){
// Double click on the element found.
await desktopBot.doubleClick()
}
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm')){
// Double click on the position x=100 and y=200 relative to the element found.
await desktopBot.doubleClickRelative(100, 200)
}
Triple-click on the element¶
If you need to triple-click on the element or triple-click on a relative position of the element, use the methods below.
Note
The find()
is used to look for the element and collect its position. Click here for more information.
# Looking for the element on the page with the label 'SubmitForm'.
if bot.find(label='SubmitForm', matching=0.97, waiting_time=10000):
# Triple-click on the element found.
bot.triple_click()
# Looking for the element on the page with the label 'SubmitForm'.
if bot.find(label='SubmitForm', matching=0.97, waiting_time=10000):
# Triple click on the position x=100 and y=200 relative to the element found.
bot.triple_click_relative(x=100, y=200)
// Looking for the element on the page with the label 'SubmitForm'.
if (find("SubmitForm", 0.97, 10000)) {
// Triple click on the element found.
tripleClick();
}
// Looking for the element on the page with the label 'SubmitForm'.
if (find("SubmitForm", 0.97, 10000)) {
// Triple click on the position x=100 and y=200 relative to the element found.
tripleClickRelative(100, 200);
}
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm'){
// Triple click on the element found
await desktopBot.tripleClick()
}
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm'){
// Triple-click on the position x=100 and y=200 relative to the element found.
await desktopBot.tripleClickRelative(100, 200)
}
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm'){
// Triple-click on the element found.
await desktopBot.tripleClick()
}
// Looking for the element on the page with the label 'SubmitForm'.
if (await desktopBot.find('SubmitForm'){
// Triple-click on the position x=100 and y=200 relative to the element found.
await desktopBot.tripleClickRelative(100, 200)
}
Pressing and releasing the mouse button¶
To press and release the mouse button use the methods below, currently only the left button is supported.
Scroll through the screen¶
If you need to navigate around the screen using scrolling up or down, use the methods below.