3

I want to verify that one screen string value with other screen string value. For example, if I try to select one product from the product list screen, the product detail screen is opened which is selected from the list. In this case, I want to verify the product name whether the selected product and opened product is the same or not by using protractor.

This is my Code:

productName = element(by.css('.item_name .ng-binding')).get(value).filter(function(text)
{
 if(productName.getText() == element.all(by.css('.LinesEllipsis')).get(1))
 {
 productName.click();
 expect(element.all(by.css('.LinesEllipsis')).get(1).isDisplayed()).toBeTruthy();
 }
}
JAINAM
1,8453 gold badges19 silver badges39 bronze badges
asked Feb 14, 2019 at 21:06
4
  • 1
    Maybe I am reading the question wrong. Can't you store the strings in a variable and later compare them and make sure it is same ? Commented Feb 15, 2019 at 10:43
  • Sorry Bro, Before I update wrong code now I changed. Please check once and tell me what mistake I did here. Commented Feb 15, 2019 at 13:20
  • It this code throwing an error? If so, please post that too. At a glance, it doesn't look like you have your declaration closed properly: productName = element(by.css('.item_name .ng-binding')).get(value).filter(function(text)). You are missing a ')' it looks like to me. Commented Feb 15, 2019 at 15:33
  • What is 'get(value)' here? There are multiple syntax issues with this code. Commented Feb 16, 2019 at 11:42

1 Answer 1

1

I am new to the Protractor but in our software quality assurance company many teams are working on the protractor and I had faced the similar issues while automating the tests and had taken their help on the same. Hopefully below code snippet will work.

productName = element(by.css('.item_name .ng-binding')).get(value).filter(function(text)
{
 if(productName.getText() == element.all(by.css('.LinesEllipsis')).get(1))
 {
 productName.click();
expect(element.all(by.css('.LinesEllipsis')).get(1).isPresent()).toBe(true);
 }
}

Please do share your code with error if below code is not working. Thanks

answered Feb 20, 2019 at 7:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.