Difference between --headless and not, emulating login
See original GitHub issueI don’t think that this is directly a problem with chrome-remote-interface but I thought I would log it here just in case it is. In the following code, I’m emulating a login with amazon. The problem is that it works if I don’t start chrome headless but with remote debugging. If I simply add the --headless and take a screenshot, it says “enter valid email or mobile number.” The values show dumped to console in both instances and they are correct.
try {
await Network.enable();
await Security.enable();
await Security.setOverrideCertificateErrors({override: true});
await Page.enable();
await DOM.enable();
await Network.setCacheDisabled({cacheDisabled: true});
await Page.navigate({url: 'https://www.amazon.com/'});
await Page.loadEventFired();
result = await Runtime.evaluate({
expression: 'document.getElementById("ap_email").value = "email@host.com"'
});
var result = await Runtime.evaluate({
expression: 'document.getElementById("ap_password").value = "password"'
});
result = await Runtime.evaluate({
expression: 'document.getElementById("ap_password").value'
});
console.log(result);
result = await Runtime.evaluate({
expression: 'document.getElementById("ap_email").value'
});
console.log(result);
result = await Runtime.evaluate({
expression: 'document.getElementsByName("signIn")[0].submit()'
});
await Page.loadEventFired();
const {data} = await Page.captureScreenshot();
fs.writeFileSync('screenshot.png', Buffer.from(data, 'base64'));
} catch (err) {
console.error(err);
} finally {
client.close();
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
What Is Headless Browser And Headless Browser Testing
Headless – Oh Yes, you read it right. Headless, means a Web Browser without User Interface. To elaborate, Headless Browsers are those which ......
Read more >What is Headless Browser Testing and Why is it Important?
So, when it comes to Headless Browsers (Yep! You heard it right, it is called “headless”), it means a browser without a user...
Read more >python 3.x - google login working in without headless but not ...
im trying to login into my google account using python selenium with chromedriver, the code works but not in headless mode. in hm...
Read more >How to Test on Headless Emulators and Simulators with Appium
Find out how you can use Appium to start Android emulators and iOS simulators in a "headless" mode.
Read more >Getting Started with Headless Chrome - Chrome Developers
A headless browser is a great tool for automated testing and server environments where you don't need a visible UI shell.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, I’ve set up an account and I have a reproducable script in full. How can I get you the credentials?
Result screen shots: Full: Headless:
Thanks, I’ll look into it.