【问题标题】:Python Chrome Driver Click Reader View on Safari Web BrowserPython Chrome 驱动点击 Safari Web 浏览器上的阅读器查看
【发布时间】:2020-05-13 23:39:41
【问题描述】:

抓取网站时如何在 Safari 浏览器中点击“阅读器视图”?

网址:https://www.w3resource.com/java-exercises/collection/index.php

我需要一个 python 脚本来单击阅读器视图,然后将所有内容复制到一个文本文件中。

请查看我当前代码的 sn-p:

options = webdriver.ChromeOptions()

driver = webdriver.Chrome('/usr/local/bin/chromedriver', options=options)
url = "https://www.w3resource.com/java-exercises/collection/index.php"
# TODO: Click Reader View.
# Copy all text on Reader View to a string variable.
# Paste string to a text file. 

【问题讨论】:

    标签: python selenium selenium-chromedriver screen-scraping


    【解决方案1】:

    您能否将快捷方式发送到启用阅读器视图的页面?下面的代码我没有尝试过,但希望它可以提供帮助。

    reader_view = Keys.chord(Keys.SHIFT, Keys.COMMAND, "r");
    driver.findElement(By.Xpath("//something")).sendKeys(selectAll);
    

    【讨论】:

    猜你喜欢
    • 2022-11-28
    • 2011-07-11
    • 2013-02-22
    • 1970-01-01
    • 1970-01-01
    • 2015-01-15
    • 1970-01-01
    • 1970-01-01
    • 2020-05-11
    相关资源
    最近更新 更多