Using chromedp , how can i check if an element is present on the page?

agolangf · · 437 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>i used to do that with python and selenium user = browser.find_element_by_css_selector(user_input) this gives me a pointer to the element or nil value , which i can check to see if the element is there but how can i do that with chromedp</p> <hr/>**评论:**<br/><br/>raff99: <pre><p>Chrome debugger protocol has DOM.QuerySelector and DOM.QuerySelectorAll methods. Not sure how they are exposed in chromedp.</p> <p>I tried them out with my implementation: <a href="https://github.com/raff/godet/blob/fa9486a9c62f0a3eec7474be590c87e1a407f9a6/cmd/godet/main.go#L413" rel="nofollow">https://github.com/raff/godet/blob/fa9486a9c62f0a3eec7474be590c87e1a407f9a6/cmd/godet/main.go#L413</a></p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

437 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传