Skip to content

Commit 71493f1

Browse files
author
Maryam Huntsperger
committed
address comments
1 parent 41f9cfd commit 71493f1

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

internal/devtools.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,28 +1360,28 @@ def type_text(self, string):
13601360
self.send_character(char)
13611361
except Exception:
13621362
logging.exception('Error running type command')
1363-
def mouse_press(self, commandOptions):
1363+
def mouse_press(self, command_options):
13641364
"""Press down the mouse"""
13651365
params = {
13661366
'type': 'mousePressed',
1367-
'x': commandOptions['x'],
1368-
'y': commandOptions['y'],
1369-
'button': commandOptions['button'],
1370-
'clickCount': commandOptions['clickCount']
1367+
'x': command_options['x'],
1368+
'y': command_options['y'],
1369+
'button': command_options['button'],
1370+
'clickCount': command_options['clickCount']
13711371
}
13721372
self.send_command('Input.dispatchMouseEvent', params)
13731373

1374-
def mouse_release(self, commandOptions):
1374+
def mouse_release(self, command_options):
13751375
"""Let up the mouse"""
13761376
self.send_command('Input.dispatchMouseEvent', {
13771377
'type': 'mouseReleased',
1378-
'x': commandOptions['x'],
1379-
'y': commandOptions['y'],
1380-
'button': commandOptions['button'],
1381-
'clickCount': commandOptions['clickCount']
1378+
'x': command_options['x'],
1379+
'y': command_options['y'],
1380+
'button': command_options['button'],
1381+
'clickCount': command_options['clickCount']
13821382
})
13831383

1384-
def mouseClick(self, params):
1384+
def mouse_click(self, params):
13851385
"""Simulate pressing the mouse"""
13861386
try:
13871387
self.mouse_press(params)

internal/devtools_browser.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ def process_command(self, command):
766766
self.devtools.type_text(command['target'])
767767
elif command['command'] == 'keypress':
768768
self.devtools.keypress(command['target'])
769-
elif command['command'] == 'mouseclick':
769+
elif command['command'] == 'mouse_click':
770770
if 'target' in command:
771771
target = command['target']
772772
separator = target.find('=')
@@ -775,7 +775,6 @@ def process_command(self, command):
775775
if separator >= 0:
776776
attribute = target[:separator]
777777
attr_value = target[separator + 1:]
778-
mouseclickError = False
779778
try:
780779
query = "JSON.stringify(document.querySelector('[{0}=\"{1}\"]').getBoundingClientRect())".format(
781780
attribute, attr_value)
@@ -791,21 +790,19 @@ def process_command(self, command):
791790
clickCount = 2
792791
elif value is not None:
793792
logging.info("Click type is not defined.")
794-
mouseclickError = True
795793

796794
if 'x' in resp_json and 'y' in resp_json and 'width' in resp_json and 'height' in resp_json:
797795
x = int(float(resp_json['x'])) + int(float(resp_json['width']))/2
798796
y = int(float(resp_json['y'])) + int(float(resp_json['height']))/2
799-
commandOptions = {}
800-
commandOptions['x'] = x
801-
commandOptions['y'] = y
802-
commandOptions['button'] = button
803-
commandOptions['clickCount'] = clickCount
804-
self.devtools.mouseClick(commandOptions)
797+
command_options = {}
798+
command_options['x'] = x
799+
command_options['y'] = y
800+
command_options['button'] = button
801+
command_options['clickCount'] = clickCount
802+
self.devtools.mouse_click(command_options)
805803
except:
806-
self.task['error'] = 'Exception parsing mouseClick arguments.'
804+
self.task['error'] = 'Exception parsing mouse_click arguments.'
807805
logging.error(self.task['error'])
808-
mouseclickError = True
809806
elif command['command'] == 'waitfor':
810807
try:
811808
self.devtools.wait_for_script = command['target'] if command['target'] else None

0 commit comments

Comments
 (0)