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

Not able to proceed with scripted browser after click


#1

The scripted browser is not giving the expected output.
after searching the email from the dropdown, trying to click on view which should take me to customer page which is failing. Looks the page wait functions need to be added which I’m not sure.

https://synthetics.newrelic.com/accounts/1175115/monitors/eabb9961-fc96-4e68-ad6f-fa0eef0971dc/script

Any help is appreciated.


#2

@RyanVeitch can you help me on this request?


#3

Hi @yograj.patel - Ryan is offline at the moment. While we Relics can view your link, others in the community who may have advice can not. DO you mind posting your script directly here so that others can take a look?


#4

var assert = require(‘assert’);
var By = $driver.By,
selectbox;
$browser.manage().timeouts().pageLoadTimeout(180000);
// Navigate to the myaccount login page
$browser.get(‘https://myadmin.com’)
$browser.waitForAndFindElement($driver.By.id(‘CoxPFHeader’), 45000)
.then(function() {
// locate login field and enter Email
return $browser.findElement($driver.By.id(‘USER’)).sendKeys(‘a1newrelic’);
})
.then(function() {
// locate password and enter info
return $browser.findElement($driver.By.id(‘PASSWORD’)).sendKeys(‘xxxxxxxxx’);
})
.then(function() {
// Press submit button
return $browser.findElement($driver.By.id(‘sign-in-btn’)).click();
//})
//.then(function() {
// Search for an account and click ok
// return $browser.FindElement($driver.By.id(“searchtypedropdownbox”));
})
.then(function(){
return $browser.waitForAndFindElement($driver.By.name(‘searchType’), 50000)
.then(function(elem) {
selectbox = elem;
selectbox.click()
});
})
//Wait till dropdown opens
.then(function() {
return selectbox.findElement(By.xpath("//option[contains(.,‘Email’)]")).click();
})
.then(function() {
// enter email info
return $browser.findElement($driver.By.id(‘email’)).sendKeys(‘123865701@maili.com’);
})
.then(function() {
// Press submit button
return $browser.findElement(By.xpath(’//[@id=“c-container”]/app-root/app-shell/app-start/form/div[3]/div/button’),5000).click();
})
.then(function(){
return $browser.findElement(By.xpath(’//
[@id=“myAdminDataTbl”]/div/datatable-body/datatable-selection/datatable-scroller/datatable-row-wrapper[1]/datatable-body-row/div[2]/datatable-body-cell[3]/div/a’)).click();
})


#5

@yograj.patel In a scripted browser test that we run, we put put a given string in a search field, wait 2s for the response to come back, and then select the first entry, and hit the search button. This is done in this way. Maybe you can do something similar?

$browser.findElement($driver.By.css("input#search_field")).sendKeys("STRING");
$browser.waitForAndFindElement($driver.By.css("div.suggestion"), 2000);
$browser.findElement($driver.By.css("i.icon.entry")).click();
$browser.findElement($driver.By.css("button#submit-button")).click();

If you don’t get any further with the above suggestion, add some of these blocks to see until where you’ve progressed successfully:

console.log("Step XYZ reached");

#6

Thanks Everyone.

just tried the browser sleep at the end and it worked.

$browser.sleep(10000);

Newrelic is fun :slight_smile: