-
-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
element.page 中的timeout context 怎么cancel ? #842
Labels
bug
When you are sure about it's a bug
Comments
Please fix the format of your markdown: 1:22 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
26 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]
26 MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "```"]
47 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"]
50 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
59 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]
60 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 3] generated by check-issue |
ysmood
added
bug
When you are sure about it's a bug
and removed
question
Questions related to rod
labels
Mar 21, 2023
@ysmood 这个地方也要修改一下 // ElementByJS returns the element from the return value of the js
func (el *Element) ElementByJS(opts *EvalOptions) (*Element, error) {
e, err := el.page.Sleeper(NotFoundSleeper).ElementByJS(opts.This(el.Object))
if err != nil {
return nil, err
}
return e.Sleeper(el.sleeper), nil
} 这里也有问题 ElementByJS里面用的不是element的Context, 而是page的Context |
确实,但是你的 PR 能清理下吗? |
那个好像是自动格式化的, 不太好清...就一行代码, |
ysmood
added a commit
that referenced
this issue
Mar 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rod Version: v0.112.6
The code to demonstrate your question
下面是测试代码:
上面这段代码, 从page 获取 到element时, element携带的timeoutContext, 可以用CancelTimeout 清楚, 但是element中的page成员timeContext并没有被清除, 导致下面 执行Click时, 出现 cancel Context 错误.
具体跟踪click代码运行, 发现在下面这地方, 调用了element.page, 由于page.Context的超时时间没有被清除, 从而任务被取消.
上面是element 中的一个函数, 这个函数在click中被调用
What you got
由于element.page 超时, 倒是click返回错误: cancel context
What you expected to see
element.click 能正常执行, 除非超时
The text was updated successfully, but these errors were encountered: