Flutter中WebDriver如何监听网页刷新?
import 'package:webdriver/sync_io.dart';
final WebDriver driver = createDriver(
uri: Uri.parse('http://localhost:4444/wd/hub/'),
desired: {
'browserName': 'msedge',
'ms:edgeOptions': {
'binary':
r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
}
},
spec: WebDriverSpec.Auto);
driver.get('https://baidu.com/');
driver.addEventListener((event) {
print(event);
});
driver.timeouts.setScriptTimeout(const Duration(days: 7));
final result = driver.execute('''
location.reload();
return "Hello, World!";
''', []);
print(result);
我尝试过使用addEventListener
,但是这个函数似乎只能监听Flutter与WebDriver的通讯,无法监听浏览器事件