Youtube Google弹出窗口-硒 [英] Youtube google popup - selenium

查看:56
本文介绍了Youtube Google弹出窗口-硒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

弹出窗口

在学习python自动化过程中尝试自动执行YouTube搜索,但是遇到了一个问题.我不知道如何自动点击我同意"在弹出窗口上,希望有人可以发送解决方案

Trying to automate a YouTube search as I'm learning python automation, however I've come across a problem. I can't figure out how to automate clicking the "I agree" on the popup, hoping someone can send a solution

推荐答案

            browser.switch_to_default_content()
            browser.switch_to.frame(browser.find_elements_by_tag_name('iframe')[0])
            browser.implicitly_wait(1)
            browser.find_element_by_id('introAgreeButton').click()
            browser.switch_to.default_content()

我在这里使用的是浏览器"而不是驱动程序".

I'm using 'browser' instead of 'driver' here.

这篇关于Youtube Google弹出窗口-硒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆