-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2 instances with shared partition aren't fully sharing session #1029
Comments
Too many bugs stating the same problem, yet not fixed properly, I'm replying with additional test information on par with the OP provided details. var Nightmare = require('nightmare');
var browser1 = Nightmare({
show: true,
alwaysOnTop: false,
webPreferences: {
partition: "persist: test"
}
});
var browser2 = Nightmare({
show: true,
alwaysOnTop: false,
webPreferences: {
partition: "persist: test"
}
});
setTimeout(() => {
browser1
.authentication("user", "passwd")
.goto("https://httpbin.org/basic-auth/user/passwd")
.screenshot('test-1.png')
.then(() => {
console.log('done 1')
})
}, 0)
setTimeout(() => {
browser2
//.authentication("user", "passwd")
.goto("https://httpbin.org/basic-auth/user/passwd")
.screenshot('test-2.png')
.then(() => {
console.log('done 2')
})
}, 3000) This code is supposed to persist, but the first window returns the desired output, second one remains empty. |
also getting the same issues with similar code |
#1024 is different, for what it's worth: that's talking about a child window. Popups are, for now, not going to work (unless you create the windows yourself, like with Memory serving, partitioning has never worked particularly reliably, but I thought that in your case @entrptaher that the |
Okay, so I tried this and it did not work. Yes, the whole session and cookies was supposed to work. Tried putting them into separate files. Did not work, tried in same file, did not work. var Nightmare = require('nightmare');
setTimeout(() => {
var browser1 = Nightmare({
show: false,
alwaysOnTop: false,
webPreferences: {
partition: "persist: test"
}
});
browser1
.authentication("user", "passwd")
.goto("https://httpbin.org/basic-auth/user/passwd")
.screenshot('test-1.png')
.evaluate(()=>{
return document.body.innerText
})
.end()
.then((result) => {
if(result == "") {
console.log('result 1 is empty')
} else{
console.log(`result 1 ${JSON.parse(result)}`)
}
})
}, 0)
setTimeout(() => {
var browser2 = Nightmare({
show: false,
alwaysOnTop: false,
webPreferences: {
partition: "persist: test"
}
});
browser2
//.authentication("user", "passwd")
.goto("https://httpbin.org/basic-auth/user/passwd")
.screenshot('test-2.png')
.evaluate(()=>{
return document.body.innerText
})
.end()
.then((result) => {
if(result == "") {
console.log('result 2 is empty')
} else{
console.log(`result 2 ${JSON.parse(result)}`)
}
})
}, 5000) result
It might be a bug? |
I'm having similar problem with minimal test case when trying to persist login cookie across nightmare instances. I'm not able to as I'm on windows machine (make is not available) and vagrant box is terminal-only. |
Sorry, false alarm, cookies are working for me. |
Hey folks, The reason this issue isn't working is because every time you call In my mind you have 2 options here:
There's a couple other gotchas around that with persistent sessions and new windows that we'll be looking to address soon. |
I am opening 2 instances under the same "partition" string, note I am not using persist: but reading nightmare and electron docs, equal partition should be enough to share session
What's happening is - If I print cookies I see both share the same cookies, but If I do something like adding to cart in an ecommerce website:
What I expect: both windows to show item in cart, like if I had 2 chrome tabs on the same ecommerce website
What I get: even though on the same partition, one window shows the item in cart, the other shows an empty cart
If it helps the 2 browsers aren't being created at the same time, but with a few minutes difference.
I'd appreciate any feedback if anyone has some, thanks
The text was updated successfully, but these errors were encountered: