mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
WebContent+headless-browser: Use document.body.innerText for text tests
This should be less fickle than the "select all & copy selected text" trick we were doing earlier.
This commit is contained in:
parent
58c1cb80bb
commit
097b5e4803
4 changed files with 19 additions and 4 deletions
|
@ -80,6 +80,11 @@ public:
|
|||
return String::from_deprecated_string(client().dump_layout_tree());
|
||||
}
|
||||
|
||||
ErrorOr<String> dump_text()
|
||||
{
|
||||
return String::from_deprecated_string(client().dump_text());
|
||||
}
|
||||
|
||||
private:
|
||||
HeadlessWebContentView() = default;
|
||||
|
||||
|
@ -191,8 +196,7 @@ static ErrorOr<String> run_one_test(HeadlessWebContentView& view, StringView inp
|
|||
};
|
||||
} else if (mode == TestMode::Text) {
|
||||
view.on_load_finish = [&](auto const&) {
|
||||
view.select_all();
|
||||
result = String::from_utf8(view.selected_text()).release_value_but_fixme_should_propagate_errors();
|
||||
result = view.dump_text().release_value_but_fixme_should_propagate_errors();
|
||||
loop.quit(0);
|
||||
};
|
||||
}
|
||||
|
@ -384,8 +388,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
} else if (dump_text) {
|
||||
view->on_load_finish = [&](auto const&) {
|
||||
view->select_all();
|
||||
auto text = view->selected_text();
|
||||
auto text = view->dump_text().release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
out("{}", text);
|
||||
fflush(stdout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue