代码之家  ›  专栏  ›  技术社区  ›  Xeno Boss

两个不同的Firefox配置文件实例可以被跟踪到同一台机器上吗?

  •  0
  • Xeno Boss  · 技术社区  · 6 年前

    我正在用Selenium&firefox运行一些无头测试来登录某个网站。如果我在同一浏览器中的不同firefox配置文件之间切换,以登录到网站上的不同帐户,除了IP跟踪之外,还有什么方法可以跟踪我的连接并发现它们都在同一台机器上(Selenium脚本正在运行)?

    我在做什么:

    profile = webdriver.FirefoxProfile('path/to/profile1')
    driver = webdriver.Firefox(profile)
    driver.get("website.com")
    #connect as user1 on website & do stuff...
    driver.quit()
    
    profile = webdriver.FirefoxProfile('path/to/profile2')
    driver = webdriver.Firefox(profile)
    driver.get("website.com")
    #connect as user2 on website & do stuff...
    driver.quit()
    

    1 回复  |  直到 6 年前
        1
  •  0
  •   undetected Selenium    6 年前

    Multiple Firefox profiles

    Firefox中的配置文件是用户在其Firefox副本中创建或安装的设置、自定义、附加组件和其他个性化设置的集合。

    拥有多个配置文件的原因

    Web开发人员可能需要一个辅助配置文件,用于在不同的Firefox频道上测试网站、应用程序或其他项目。例如,您可能希望安装一些用于Web开发的扩展,而不是用于通用Web浏览。

    偏好 书签 ,和 历史 . 设置一个新的配置文件只需很少的时间,一旦完成,所有的Firefox版本都将分别更新,并且可以同时运行。

    打破神话

    所以有多个 Firefox浏览器客户端 具有多个 Firefox配置文件 可以同时运行。所以你的假设 …如果我在同一浏览器中的不同firefox配置文件之间切换以登录到不同的帐户。。。 不正确。这个 Web浏览客户端 变体可能是相同的,即。 但他们每个人都会继承不同的 偏好 , 书签 ,和 .


    User Agent

    你的用户代理告诉你访问的每个站点你正在使用什么浏览器。网站能够检测到你的UA,并根据需要重定向到更适合你浏览器的页面。换言之,如果您从移动电话访问具有此检测的站点,该站点可能会通过UA检测到您是移动用户,并将您重定向到他们的移动站点(如果可用)。这并不适用于所有的网站,因为不是所有的网站都有UA检测到位。

    UAs也会告诉你访问的网站你可能已经安装了一些与浏览器相关的软件。例如,此UA:

    (Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.5.30729; OfficeLiveConnector.1.3; OfficeLivePatch.0.0;) 
    

    告诉我们,访问者正在使用Internet Explorer 8、Windows Vista、安装了Media Center PC 5.0、Office Live Connector等。因此,如果我们为Vista用户设置了一个特殊的分区,我们可以根据Windows NT 6.0字符串将此人重定向到我们网站中与Vista严格相关的子分区。另一方面,此用户代理:

    Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 
    


    更新

    根据您的问题更新 我不确定 用户代理 浏览器配置文件 信息。但是基于不同的 用户代理 用户代理字符串

    Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
    

    不同的

    • 根据 useragent 版本2.1.9:

      • 行动单位

        rawUa: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
        string:
        family: Chrome
        major: 70
        minor: 0
        patch: 3538
        device: Other 0.0.0
        
      • string: Windows 8 0.0.0
        family: Windows 8
        major: 0
        minor: 0
        patch: 0
        
    • 根据 ua-parser-js

      • 行动单位

        ua: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36
        
      • name: Chrome
        version: 70.0.3538.102
        major: 70
        
      • name: WebKit
        version: 537.36
        
      • 操作系统

        name: Windows
        version: 8
        
      • 装置

        model: undefined
        vendor: undefined
        type: undefined
        
      • 中央处理器

        architecture: amd64
        
    • 根据 platform.js 1.3.3版:

      • 行动单位

        name: Chrome
        version: 70.0.3538.102
        layout: Blink
        
      • os: Windows 8 64-bit
        
      • 装置

        product:
        manufacturer:
        description: Chrome 70.0.3538.102 on Windows 8 64-bit