Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Feedback popup is causing the script to fail intermittently

scriptedbrowser
new-moderation-topic
mod_queue
sla_breaching

#1

Synthetics Question Template

https://synthetics.newrelic.com/accounts/1175115/monitors/07def3aa-b660-47be-823c-3cd439b611b9/script?tw[start]=1569871132.584&tw[end]=1569872932.584

/**

$browser.manage().timeouts().pageLoadTimeout(180000);
// Navigate to thelogin page
$browser.get(‘https://myaccount.coxbusiness.com’)
//$browser.waitForAndFindElement($driver.By.id(‘CoxPFHeader’), 60000)
.then(function() {
// locate login field and enter Email
return $browser.findElement($driver.By.id(‘USER’),2000).sendKeys(‘nate@.com’);
})
.then(function() {
// locate password and enter info
return $browser.findElement($driver.By.id(‘PASSWORD’),2000).sendKeys(‘pass’);
})
.then(function() {
// Press submit button
return $browser.waitForAndFindElement($driver.By.id(‘sign-in-btn’),5000).then(function(element){
element.click();
});
})
.then(function() {
// Select Voice Tools
return $browser.waitForAndFindElement($driver.By.xpath("//[@id=“c-container”]/app-root/app-shell/app-myaccounthome/div/div/app-welcome-widget/div/div[1]/div[2]/div/ul/li[4]/a"),10000).then(function(element){
element.click();
});
})
.then(function () {
// Select User and feature settings
return $browser.waitForAndFindElement($driver.By.xpath("//
[@id=“bhome-form:billpay-widget-content”]/div[2]/ul/li[1]/a"),10000).then(function(element){
element.click();
});
})
.then(function () {
// Click on Edit
return $browser.waitForAndFindElement($driver.By.xpath("//[@id=“dataTableUsersList”]/div/datatable-body/datatable-selection/datatable-scroller/datatable-row-wrapper[2]/datatable-body-row/div[2]/datatable-body-cell[4]/div/p/a"),10000).then(function(element){
element.click();
});
})
.then(function () {
// Click on Settings
return $browser.waitForAndFindElement($driver.By.xpath("//
[@id=“call-header”]/a/div/h3"),10000).then(function(element){
element.click();
});
})
.then(function () {
// Select option
return $browser.waitForAndFindElement($driver.By.xpath("//[@id=“call”]/div/div/div[1]/div/ul/li[1]/a"),10000).then(function(element){
element.click();
});
})
.then(function(){
$browser.sleep(10000);
return $browser.findElement(By.xpath(’//
[@id=“voice-container”]/div/app-shell/app-userfeaturesettings/app-callforwarding/div/div/form/div[3]/div[1]/button’)).then(function(element){
return element.getText().then(function(text){
//assert.equal(‘Call Forwarding Selective Rule’, text, ‘Call Forwarding did not load as expected’);
});
});
})

The pop up can be seen at any page which is blocking the script not to proceed further.


#2

@yograj.patel - If you’re aware of the circumstances that cause the popup to pop up - you should be able to add some handling for that. There’s a thread on handling popups here:


#3

Hi @RyanVeitch

The feedback popup can come in any page and there is no wait option to disappear. We need to close the popup manually to proceed further.

return browser switch frame didn’t work.

https://synthetics.newrelic.com/accounts/1175115/monitors/cd34701e-bdf1-4ce6-857d-72302ed609ac/script?tw[start]=1570022854.297&tw[end]=1570024654.297


#4

We are trying to close the pop up which comes on any page.

Tried both but getting error:

Try 1:

//verify if one “must-have” element within the popup present
.then(function(){
return eleIsPresent($driver.By.css(“fsrAbandonButton”))
.then(function(found){
if (found = true){
popup = $browser.findElement($driver.By.css(“fsrAbandonButton”)); //store it
return $browser.findElement($driver.By.css(“fsrAbandonButton”)).click();
}else{
console.log(“no popup,you may proceed”);
}
});
})

Try 2:

//verify if one “must-have” element within the popup present
.then(function(){
return eleIsPresent($driver.By.css(“No thanks”))
.then(function(found){
if (found = true){
popup = $browser.findElement($driver.By.xpath(’//[@id=“fsrInvite”]/section[3]/button[2]’)); //store it
return $browser.findElement($driver.By.xpath(’//
[@id=“fsrInvite”]/section[3]/button[2]’)).click();
}else{
console.log(“no popup,you may proceed”);
}
});
})

getting " no such element: Unable to locate element: {“method”:“xpath”,“selector”:"//*[@id=“fsrInvite”]/section[3]/button[2]"}Need help? See our scripting documentation"


#5

@yograj.patel - You may need to switch context into the frame the popup lives in before interacting with it -

You can do that with $browser.switchTo() - Or - ableToSwitchToFrame(frame: ?)

https://docs.newrelic.com/docs/synthetics/new-relic-synthetics/scripting-monitors/synthetics-scripted-browser-reference-monitor-versions-050


#6

https://synthetics.newrelic.com/accounts/1175115/monitors/cd34701e-bdf1-4ce6-857d-72302ed609ac/script?tw[start]=1570459594.284&tw[end]=1570481194.284

Hi Ryan,

I tried the switchTo oprion but it is not accurate. Need your assistance.


#7

Hi @yograj.patel, you may need to review your syntax in the script, there are a number of issues with it, particularly the then() functions, you have 2 return statements in some of them which is not correct javascript syntax.

The switchTo() function is also incomplete, there is a good example of how to use it in the following topic:


#8

Hi @rdouglas

The above scenario has been tried but the feedback popup can happen at any page so the above option is not working for me.

Please correct me if anything is wrong with the script.

https://synthetics.newrelic.com/accounts/1175115/monitors/07def3aa-b660-47be-823c-3cd439b611b9/script?tw[start]=1571060330.742&tw[end]=1571062130.742


#9

Hi @yograj.patel, there is actually an example for this written by one of my colleagues which checks if a popup exists before trying to close it which would be perfect for occasional popups on different pages. You can find that below:

Let me know how you get on :slight_smile:


Interacting with alert boxes
#10

@rdouglas @Michel_L

Thanks for the info. I have tried the same but still not able to succeed in closing the popup. Not sure If I’m trying wrong css (tried xpath as well). Please help me with this, it is causing lot of false alerts.

.then(() => {
console.log(‘step2: looking for campaign overlay’)
return $browser.waitForAndFindElement($driver.By.css(‘fsrAbandonButton’), 5000).then(() => {
return $browser.findElement($driver.By.css(‘fsrAbandonButton’)).click().catch((err) => {
console.log(‘Popup close button could not be clicked’)
throw err
})
}, (err) => {
console.log(‘Feedback Popup not found’);
})
})

https://synthetics.newrelic.com/accounts/1175115/monitors/07def3aa-b660-47be-823c-3cd439b611b9/script?tw[start]=1571238380.607&tw[end]=1571240180.607


#12

was able to update the rite css and got the expected result. Will wait for a day and update if it is not an issue anymore


#13

That’s awesome! Thanks for confirming - I look forward to hearing how it works in the end. :smiley:


#14

Scripts working fine post the changes made, thanks for your help… you guys are awesome


#15

Hi Newrelic Team

Issue returned. The script is executing and sometimes it throws the error and when we see the screenshot, we still see the popup. Basically it is not closing the popup.

Please help us to resolve this

https://synthetics.newrelic.com/accounts/1175115/monitors/cd34701e-bdf1-4ce6-857d-72302ed609ac/results/92a53bcc-59e1-4145-b07d-0a183288f3a2?view=screenshot&tw[start]=1573144257.282&tw[end]=1573146057.282


#16


#17

Hi Newrelic Support,

Can you please help to fix this.