ChromeDevTools / devtools-protocol

Chrome DevTools Protocol
https://chromedevtools.github.io/devtools-protocol/
BSD 3-Clause "New" or "Revised" License
1.15k stars 226 forks source link

TargetInfo has two fields(url and title) with same value #112

Closed NivedhaSenthil closed 6 years ago

NivedhaSenthil commented 6 years ago

The targetInfo that we get on targetCreated or targetInfoChanged event has two fields url and title with same value most of the times but sometimes it is actually the page title. Shouldn't the title be title of the target inspite of url all the time ?

Sample targetInfo received with 'url' and 'title' having same value,

{ targetInfo:
   { targetId: 'C1BEA709C7470F3A165331B2F1D1F480',
     type: 'page',
     title: 'https://www.google.com',
     url: 'https://www.google.com/',
     attached: true,
     browserContextId: 'FDDB225D367F22D11CBFCAFFAA55D91C' } }
JoelEinbinder commented 6 years ago

This is likely because you get the targetcreated before the page has finished loading. So the title tag has not been read yet.

NivedhaSenthil commented 6 years ago

Thanks for the quick response, doing getTargets() after page load gives right title always.

NivedhaSenthil commented 6 years ago

Just curious, shouldn't the value of title be empty instead of url if the title tag is not ready at a moment ?