-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
Why enable the browser to have two tabs and not open the web properly? #306
Comments
I use the sample code of the official website. After opening the browser, two tabs will be opened directly. My computer is Windows 7, and the test on Ubuntu last night is normal, please refer to the screenshot above.What other information do I need to provide? |
What's the meaning this path: file:///C:/Users/ADMINI~1/AppData/Local/Temp/rod/self-close.html ? |
I'm using Chrome 87, which should be up to date |
It's the default Lines 41 to 46 in 5ebed67
|
I tested ubuntu last night and saw only a TAB, not this one, just go to Baidu.com |
Can you try this code? package main
import (
"time"
"github.com/go-rod/rod"
"github.com/go-rod/rod/lib/launcher"
)
func main() {
u := launcher.New().StartURL("about:blank").MustLaunch()
page := rod.New().ControlURL(u).MustConnect().MustPage("https://www.baidu.com/")
page.MustWaitLoad().MustScreenshot("a.png")
time.Sleep(time.Hour)
} |
Seems like Chrome crashed, not sure about why is happening. I don't have Window7 to test it, not sure how to help. |
Can you install a virtual machine and test it out?Thank you very much.After all, Windows 7 still has a large user base |
Sure, I just don't have time for it now, I will check when I have time. Thank you for your report! Can you share more debug info? To enable it is easy just add one line to the show
cdp Then provide your console log to us. |
[cdp] 2020/12/11 10:04:58 => #1 @00000000 Target.setDiscoverTargets {"discover":true}
[cdp] 2020/12/11 10:04:58 <- @00000000 Target.targetCreated {"targetInfo":{"targetId":"3936a2bf-04ab-4052-9336-89db1e265db4","type":"browser","title":"","url":"","attached":true,"canAc
cessOpener":false}}
[cdp] 2020/12/11 10:04:58 <= #1 {}
[cdp] 2020/12/11 10:04:58 => #2 @00000000 Browser.getVersion {}
[cdp] 2020/12/11 10:04:58 <= #2 {"protocolVersion":"1.3","product":"Chrome/88.0.4298.0","revision":"@e62cb7e3fc7c40548cef66cdf19d270535d9350b","userAgent":"Mozilla/5.0 (Windows NT 6.1;
WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4298.0 Safari/537.36","jsVersion":"8.8.134"}
[cdp] 2020/12/11 10:04:58 => #3 @00000000 Target.createTarget {"url":"about:blank"}
[cdp] 2020/12/11 10:04:58 <- @00000000 Target.targetCreated {"targetInfo":{"targetId":"4D311CABDF463EE3798C316448037D21","type":"page","title":"","url":"about:blank","attached":false,"
canAccessOpener":false,"browserContextId":"A23D0D2DD4592241D0596610C745276F"}}
[cdp] 2020/12/11 10:04:58 <= #3 {"targetId":"4D311CABDF463EE3798C316448037D21"}
[cdp] 2020/12/11 10:04:58 => #4 @00000000 Target.attachToTarget {"targetId":"4D311CABDF463EE3798C316448037D21","flatten":true}
[cdp] 2020/12/11 10:04:58 <- @00000000 Target.targetCrashed {"targetId":"4D311CABDF463EE3798C316448037D21","status":"failed to launch","errorCode":18}
[cdp] 2020/12/11 10:04:58 <- @00000000 Target.targetInfoChanged {"targetInfo":{"targetId":"4D311CABDF463EE3798C316448037D21","type":"page","title":"","url":"about:blank","attached":tru
e,"canAccessOpener":false,"browserContextId":"A23D0D2DD4592241D0596610C745276F"}}
[cdp] 2020/12/11 10:04:58 <- @00000000 Target.attachedToTarget {"sessionId":"D95252CF92D83220F0FD15D0207F3177","targetInfo":{"targetId":"4D311CABDF463EE3798C316448037D21","type":"page"
,"title":"","url":"about:blank","attached":true,"canAccessOpener":false,"browserContextId":"A23D0D2DD4592241D0596610C745276F"},"waitingForDebugger":false}
[cdp] 2020/12/11 10:04:58 <= #4 {"sessionId":"D95252CF92D83220F0FD15D0207F3177"}
[cdp] 2020/12/11 10:04:58 => #5 @D95252CF Page.enable {} |
Seems like an upstream Chrome bug. Can you run this: package main
import (
"time"
"github.com/go-rod/rod"
"github.com/go-rod/rod/lib/launcher"
)
func main() {
u := launcher.NewUserMode().MustLaunch()
page := rod.New().ControlURL(u).MustConnect().MustPage("https://www.baidu.com/")
page.MustWaitLoad().MustScreenshot("a.png")
time.Sleep(time.Hour)
} |
There are two blank pages first, and then a blank page is automatically closed |
I tested it on another win7 and had exactly the same problem. |
[cdp] 2020/12/11 10:15:38 => #1 @00000000 Target.setDiscoverTargets {"discover":true} |
Can you kill all Chrome processes then try my last code again? |
Does headless mode work? |
It also doesn't work properly and doesn't see the PNG file |
[cdp] 2020/12/11 10:28:06 => #1 @00000000 Target.setDiscoverTargets {"discover":true} |
Thank you, I think it's enough now, we will test Win7 later. I missed this OS because seldom developers nowadays still use Win7. @NormalPunch is checking Win7. |
Thank you. This is my first time using this framework, and I feel the documentation is excellent.I used Chromedp before, and it worked fine, but It didn't feel stable enough to fail when I clicked on an element multiple times |
Although the development of people using Win7 is not much, but the user use Win7 or a lot of my customers are Win7, Win7 this system or do not give up, thank you |
Published the v0.85.0, should be fixed. |
Thank you very much |
@ysmood After your repair, the Baidu website can be normally opened, but there is an extra blank page. How to remove this blank page |
@smp12345 Don't remove it, the reason is the last line of here: https://pkg.go.dev/github.com/go-rod/rod@v0.85.4/lib/launcher#New |
I see what you mean, but in this case, the user experience is not very good. Can We use the MustPage url as an active page? |
I mainly use this framework for automation, it would be better to automate the interface, I need to see the process of execution, but there is an extra blank page, it doesn't look comfortable @ysmood |
This commit should have fixed your issue 475b659 Please check v0.85.6 |
That's OK. Thank you very much |
Rod Version: v0.84.3
chrome Version: 版本 87.0.4280.88(正式版本)
go Version : go1.14.4 windows/amd64
Windows7
sample code:
When running the code above, chrome will open two browser window directly, one of the Windows web site: file:///C:/Users/ADMINI~1/AppData/Local/Temp/rod/self-close.html, the other is a blank page, baidu.com is not normal to open
Help me, thank you
The text was updated successfully, but these errors were encountered: