Codeception: Setting phantomjs/WebDriver useragent

Created on 28 Nov 2013  路  2Comments  路  Source: Codeception/Codeception

Hey, haven't been able to set the useragent for phantomjs using the new webdriver via capabilities.

acceptance.suite.yml is as follows:

    config:
        WebDriver:
            url: 'http://build2.domain/'
            browser: 'phantomjs'
            port: 9988
            delay: 200
            wait: 10
            capabilities:
              userAgent: "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36"

Any suggestions?

Most helpful comment

Sorted this out now. For anyone else wondering:

class_name: WebGuy
modules:
    enabled:
        - WebHelper
        - WebDriver
    config:
        WebDriver:
            url: 'http://build2.domain/'
            browser: 'phantomjs'
            port: 9988
            capabilities:
                phantomjs.page.settings.userAgent: "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36"

All 2 comments

Sorted this out now. For anyone else wondering:

class_name: WebGuy
modules:
    enabled:
        - WebHelper
        - WebDriver
    config:
        WebDriver:
            url: 'http://build2.domain/'
            browser: 'phantomjs'
            port: 9988
            capabilities:
                phantomjs.page.settings.userAgent: "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36"

This helped me a lot!

Was this page helpful?
0 / 5 - 0 ratings