import 'package:html/parser.dart' show parse;
import 'package:http/http.dart' as http;
void main() async {
final response =
await http.get(Uri.parse('https://bitwarden.com/password-strength/'));
final document = parse(response.body);
final searchBox = document.querySelector('.css-35zt5t')!;
final query = 'Hello*World123';
// searchBox value is not updating hence getting the same result as very week
searchBox.innerHtml = query;
// parent element tha'll have the result once the query is posted
var parent = document.querySelector('.css-189dhzu')!;
// only div element that'll have the result
var divElement = parent.querySelector('div');
if (divElement != null && divElement.text.isNotEmpty) {
print(divElement.text);
} else {
print('Div element not found or has no text content');
}
}
代码可能没有将值推送到网站的输入字段。找到了一种方法,但它使用控制台应用程序不支持的 dart:html pkg。任何帮助将不胜感激。