@pytest.mark.parametrize('js_enabled, expected', [(True, 2.0), (False, 2.0)])
def test_element_js_webkit(webview, js_enabled, expected):
 from PyQt5.QtWebKit import QWebSettings
 webview.settings().setAttribute(QWebSettings.JavascriptEnabled, js_enabled)
 elem = webview.page().mainFrame().documentElement()
 result = elem.evaluateJavaScript('1 + 1')
 assert (result == expected)

@ pytest . mark . parametrize ( 'js_enabled, expected' , [ ( True , 2.0 ) , ( False , 2.0 ) ] ) def test_element_js_webkit ( webview , js_enabled , expected ) : from PyQt5 . QtWebKit import QWebSettings webview . settings ( ) . setAttribute ( QWebSettings . JavascriptEnabled , js_enabled ) elem = webview . page ( ) . mainFrame ( ) . documentElement ( ) result = elem . evaluateJavaScript ( '1 + 1' ) assert ( result == expected )
with qtwebkit .