playwright-rust icon indicating copy to clipboard operation
playwright-rust copied to clipboard

page.evaluate_on_selector hangs indefinitely and doesn't timeout on error

Open randall-coding opened this issue 3 years ago • 1 comments

I have two calls to page.evaluate_on_selector, the first completes, but the second seems to have a problem. Changing the order doesn't matter, so it looks like the problem is with my selector and I can fix that. The issue I want to address is that the error itself never occurs and the function simply hangs.

Here is the code in question:

let title_xpath = "xpath//*[@itemprop='title']";
let title: String = page.evaluate_on_selector::<String, String>(title_xpath,"node => node.innerHTML", None).await.unwrap();

I see the error in my code, but we should expect some kind of error to be produced* and visible, instead of the program hanging indefinitely.

randall-coding avatar Apr 22 '22 05:04 randall-coding

It throws an error on request parse.

  • Submit an improvement pr to the original.
  • or put a timeout on the client side

I'll think about it later.

octaltree avatar Sep 19 '22 08:09 octaltree