Git Product home page Git Product logo

Comments (4)

tomasdev avatar tomasdev commented on June 9, 2024

Hey Paul, I don't know if this is a bug or I'm not fully understanding the method:

function onPageLoad(Runtime) {
  return Runtime.evaluate({expression: "navigator.userAgent"}).then(result => console.log('UA: ' + result.result.value));
}
launchChrome().then(launcher => {
  chrome(protocol => {
    const {Page, Runtime, Network} = protocol;
    Promise.all([
      Page.enable(),
      Runtime.enable(),
      Network.enable()
    ]).then(() => {
      Network.setUserAgentOverride('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36');
      Page.navigate({url: 'https://google.com/'});
      Page.loadEventFired(() => {
        onPageLoad(Runtime).then(() => console.log('done'));
      });
      // ...

is printing HeadlessChrome as the UA :/

Nevermind... setUserAgentOverride is async.

from devtools-protocol.

gsouf avatar gsouf commented on June 9, 2024

Agreed, spent time trying to figure out why Network.setUserAgentOverride didn't work, would be great to have a fix

from devtools-protocol.

ganchuhang avatar ganchuhang commented on June 9, 2024

Is this issue still open?
await cdp.send(Network.setUserAgentOverride({userAgent:"${config.userAgent}"}));
still cannot

from devtools-protocol.

TimvdLippe avatar TimvdLippe commented on June 9, 2024

This repository is related to Chrome DevTools Protocol, but does not track issues regarding its definition or implementation. If you want to file an issue for the Chrome DevTools Protocol, please open an issue on https://crbug.com under component: Platform>DevTools>Platform. Thanks in advance!

from devtools-protocol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.