简体   繁体   English

使用PythonAnywhere时无法在网页上进行Selenium搜索

[英]Can't make Selenium search on a web page when using PythonAnywhere

I'm trying to find some elements on https://instagram.com using Selenium and my code works on my computer, but when I run it on PythonAnywhere and try to find at least body it returns " ". 我试图找到一些元素https://instagram.com使用Selenium和我的代码工作在我的电脑上,但是当我在PythonAnywhere运行它,并试图找到至少身体返回“”。 Code: 码:

from selenium import webdriver

def code():
    browser = webdriver.Firefox()
    browser.get('https://instagram.com')
    print(browser.find_element_by_tag_name('body').text)

def main():
    code()

if __name__ == '__main__':
    main()

I tried to test it with some random web-sites from their Whitelist and it Worked! 我尝试使用其白名单中的一些随机网站对其进行测试,并且效果良好! But Instagram is also there... So, I am a little bit confused. 但是Instagram也在那里...所以,我有点困惑。 What's my mistake? 我怎么了 Any help is appreciated. 任何帮助表示赞赏。

We have not whitelisted the top-level instagram domain (instagram.com) only the subdomains (like api.instagram.com etc.) so you cannot scrape instagram using selenium. 我们没有将顶级instagram域(instagram.com)仅列入子域(如api.instagram.com等)的白名单,因此您无法使用硒抓取instagram。 You can, however, use the API since that is the preferred way of accessing instagram from software. 但是,您可以使用API​​,因为这是从软件访问instagram的首选方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用 python 中的 selenium 使 web 页面的隐藏部分处于活动状态 - Can't make hidden part of a web page active using selenium in python 无法使用 selenium 在带有 python 的网页上进行此搜索 - Can't make this search on a webpage with python using selenium 使用 Selenium Python 在网页上找不到元素 - Can't find elements on web page using Selenium Python 使用硒无法访问跨度包装的网页按钮 - Can't Access Web Page Button Wrapped in Span Using Selenium 为什么我不能让 Selenium 使用 Python 3.8 和 Chrome 在我的 WhatsApp Web 中编写消息? - Why can't I make Selenium write a message in my WhatsApp Web using Python 3.8 and Chrome? 当使用 Python 和 Selenium 抓取 web 时,如何从单个页面获取所有 href 链接? - How can I get all the href links from a single page when web scraping using Python and Selenium? 使用selenium进行web抓取时如何清除搜索区域 - How to clear search area when using selenium for web scraping 我们可以使用 selenium web 浏览器的网站上的搜索功能吗 - Can we use the search functionality on the website using selenium web browser Selenium 无法从动态网页中找到类元素 - Selenium can't find class element from dynamic web page 如何在 python 中使用 selenium webdriver 滚动 web 页面? - How can I scroll a web page using selenium webdriver in python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM