Comments (8)
Well if you want to be lazy, use this:
To reduce pain:
document.querySelector("body > settings-ui").shadowRoot.querySelector("#main").shadowRoot.querySelector("settings-basic-page").shadowRoot.querySelector("#basicPage > settings-section:nth-child(7) > settings-privacy-page").shadowRoot.querySelector("#clearBrowsingData").shadowRoot.querySelector("#label")
from rod.
fixed some bugs recently, please try the latest version
from rod.
fixed some bugs recently, please try the latest version
Yes, rod
in my go.mod
was the latest version.
github.com/ysmood/rod v0.37.0
from rod.
If you try document.querySelector("#clearBrowsingData")
it will return null.
When you debug please use Trace(true)
:
rod.New().ControlURL(u).Trace(true).Connect()
It will tell you what rod is doing, this time it's retrying to get something that it can't get.
The reason is this page is using shadow-dom. You have to use something like this:
clearBrowsingData := page.Element("settings-ui").ShadowRoot().
Element("#main").ShadowRoot().
Element("settings-basic-page").ShadowRoot().
Element("settings-privacy-page").ShadowRoot().
Element("#clearBrowsingData")
It's like the iframe, I'm thinking of a way to make it easier but it will take some time.
from rod.
😂 Man, you don't have to do this kind of crazy thing, Rod has browser.Incognito()
to create isolated env.
from rod.
If you try
document.querySelector("#clearBrowsingData")
it will return null.
When you debug please useTrace(true)
:rod.New().ControlURL(u).Trace(true).Connect()
It will tell you what rod is doing, this time it's retrying to get something that it can't get.
![]()
The reason is this page is using shadow-dom. You have to use something like this:
clearBrowsingData := page.Element("settings-ui").ShadowRoot(). Element("#main").ShadowRoot(). Element("settings-basic-page").ShadowRoot(). Element("settings-privacy-page").ShadowRoot(). Element("#clearBrowsingData")It's like the iframe, I'm thinking of a way to make it easier but it will take some time.
Trace
is cool, thx
from rod.
😂 Man, you don't have to do this kind of crazy thing, Rod has
browser.Incognito()
to create isolated env.
Yean but too much costs for restarting a browser. And sometimes incognito will be detected.
And it seems that cdp api cannot clear all domains.
from rod.
Cool, solved, thanks @ysmood
from rod.
Related Issues (20)
- 获取点击后的response失败 HOT 2
- How to hide chromium command prompt HOT 2
- Element存在,但Element.MustHas却为false,检测不到Element HOT 2
- How to open a new Chrome window while using remote control HOT 4
- Using go-rod with firefox, failing to start new instance of firefox HOT 6
- How to disable the dialog when open External protocols HOT 2
- How to Set or replace response headers HOT 2
- Proxy and Hijack HOT 3
- Just a recipe to run a go-rod program as systemd service HOT 1
- How to Log CDP Logs to a File or Use slog HOT 2
- Failed to deserialize params.body - BINDINGS: binary value expected at position 61 HOT 5
- failed page screenshot in defer HOT 2
- launcher docker 是否支持常驻且直接连接 HOT 4
- Examples fail on Ubuntu 24.04 with "No usable sandbox!" HOT 8
- Open the webpage, the page size is changed HOT 1
- Limit the number of redirects and store all accessed URLs HOT 1
- NewUserMode 无法关闭浏览器 HOT 1
- NewUserMode 和 NewManaged 可以同时使用吗 HOT 1
- How do I get Ifram without using--disable-site-isolation-trials? HOT 4
- navigation failed: net::ERR_TUNNEL_CONNECTION_FAILED HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rod.