I have a basic event handler I am testing receives a callback, written in Dart:
void handleMouseOverEvent(MouseEvent e){
print(' x:'+ e.client.x.toString() + ' y:' + e.client.y.toString());
}
I am using Selenium to automate a test verifying this method is called. My plan is to write the XY coordinates of the event to verify it is called.
I am using a python selenium script to do this:
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from MouseMoves import TestMouseMoves
capabilities = DesiredCapabilities.CHROME
capabilities['loggingPrefs'] = { 'browser':'ALL' }
driver = webdriver.Chrome(desired_capabilities=capabilities)
driver.get("http://localhost:63343/Dart_WebStorm/web/index.html")
TestMouseMoves()
for entry in driver.get_log('browser'):
print entry
for entry in driver.get_log('driver'):
print entry
driver.close()
Based on Getting console.log output from Chrome with Selenium Python API bindings (though using Dart and not Javascript for log generation).
TestMouseMoves is a method to fake mouse movement by moving my mouse cursor all over the screen.
I have verified that my Dart application is printing console output in the selenium instance. By removing the driver.close() and investigating the console log for the created session, I see the below.
I do not know why I am not seeing these logs in my two print statements. Those are the only two logs available (driver.log_types returns [u'browser', u'driver']
). Selenium documentation suggests there are also client/server logs available (but these do not seem to be captured here).
My python selenium script prints out the below message, which suggests the first entry in the console is being printed (it appears to match the first entry):
{u'source': u'deprecation', u'message': u'deprecation 0:0 /deep/ combinator is deprecated. See https://www.chromestatus.com/features/6750456638341120 for more details.', u'timestamp': 1448212138717, u'level': u'WARNING'}
I have also tried window.console.log('stuff here');
instead of print for the Dart logging as well. And I have added a 4 second delay before my print to help with potential timing issues.
How can I modify either my Dart and/or Python selenium script to retrieve and print the logs generated by this mouseover event?