zoukankan      html  css  js  c++  java
  • selenium使用中driver.get(url)时遇到的问题

            broswer = webdriver.Firefox()
            broswer.get("https://www.smzdm.com/p/20765776/#hfeeds")
    
                    # self.logger.info(broswer.page_source)
    
            goods_scrapy_selector = Selector(text=broswer.page_source)
    
            title_selector = goods_scrapy_selector.css(".J_title")
    
            title = title_selector.get()
    
            self.logger.info(title)
    
            broswer.get("https://www.smzdm.com/p/20769796/#hfeeds")
    
            goods_scrapy_selector = Selector(text=broswer.page_source)
    
            title_selector = goods_scrapy_selector.css(".J_title")
    
            title = title_selector.get()

    不知道问什么,broswer只有在执行第一句的get时浏览器才会去加载页面,第二句不会去加载导致第二句的title是第一个地址的值。后来发现是url中#hfeeds这个锚的问题,去掉#feeds就好了,具体什么原因还不清楚。

    喜欢艺术的码农
  • 相关阅读:
    hdu 3496
    poj 2374
    zoj 3399
    poj 1321
    sgu 365
    hdu 3555
    poj 3345
    poj 2355
    Android重命名文件
    在workflow中传值的sample
  • 原文地址:https://www.cnblogs.com/zjhgx/p/12815532.html
Copyright © 2011-2022 走看看