Skip to content

Commit 389c9b3

Browse files
authored
Merge pull request #34 from lf2a/fix-click-on
FIX: 'click_on()' method
2 parents 079033f + 1242e57 commit 389c9b3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

botcity/web/bot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,6 @@ def leave_iframe(self):
11001100
#######
11011101
# Mouse
11021102
#######
1103-
@only_if_element
11041103
def click_on(self, label):
11051104
"""
11061105
Click on the element.
@@ -1109,7 +1108,9 @@ def click_on(self, label):
11091108
label (str): The image identifier
11101109
"""
11111110
x, y = self.get_element_coords_centered(label)
1112-
self.click(x, y)
1111+
if None in (x, y):
1112+
raise ValueError(f'Element not available. Cannot find {label}.')
1113+
self.click_at(x, y)
11131114

11141115
@only_if_element
11151116
def get_last_x(self):

0 commit comments

Comments
 (0)