Skip to content
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

关于 context 的问题 #626

Closed
Niexiawei opened this issue Jun 16, 2022 · 5 comments
Closed

关于 context 的问题 #626

Niexiawei opened this issue Jun 16, 2022 · 5 comments
Labels
question Questions related to rod

Comments

@Niexiawei
Copy link

Rod Version: v0.107.1

	_ = login.Page.Navigate(config.Config.MeituanLogin.Url)
	loginFrame := login.Page.Timeout(5 * time.Second).
		MustElement("iframe[title=登录模块]").
		CancelTimeout().
		MustFrame()

	loginFrame.Timeout(3 * time.Second).MustElement("#loginContainer .container .header__nav .header__nav-link_0").MustClick().CancelTimeout()
	login.LoginFrame = &pages.Page{loginFrame}
	login.writerAccountInfo()

image

我在 第一段代码中 执行了 CancelTimeout() 按照我的理解 返回的 loginFrame 应该是不携带 timeout的
但是在第二段代码执行后 就会执行报错 panic: context canceled

image
不知道这么写是否正确 还是我理解上面有错误

@Niexiawei Niexiawei added the question Questions related to rod label Jun 16, 2022
@rod-robot
Copy link

Please fix the format of your markdown:

17 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]

Please fix the golang code in your markdown:

@@ golang markdown block 1 @@
1:2: expected 'package', found _
1:4: expected 'IDENT', found '='
1:6: expected ';', found login

generated by check-issue

@Niexiawei
Copy link
Author

image

把第二段代码中的 timeout 移除后依旧会出现这个问题

@ysmood
Copy link
Member

ysmood commented Jun 16, 2022

panic: context canceled 不是 timeout, timeout 报错应该是 deadline exceeded

@ysmood ysmood closed this as completed Jun 16, 2022
@Niexiawei
Copy link
Author

那请问一下 为什么会出现context cancel呢 是我使用方式有问题吗

@ysmood
Copy link
Member

ysmood commented Jun 16, 2022

#322 如果你不按照第3条来提问,我也不知道问题是什么

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions related to rod
Projects
None yet
Development

No branches or pull requests

3 participants