0

enter image description hereI am using playwright, working with an ERP (IFS) system and I can't figure out the locator for my text on page to be verified. How can we verify the text on a page without locator?

I tried the following

expect(this.page.getByText('Success!').isVisible());

To my surprise when I tried following it still passes when "Go home" does not exists on the page, so clearly something is wrong there

expect(this.page.getByText('Go home!').isVisible);

I tried with followin

expect(page.locator(('#Form-WorkOrderContactList-fndRow-1-Cf_Contact_Type'))).toBe("Success");

it gives error as follow

Expected: "Success" 
Received: {"_frame": {"_guid": "frame@b4a0f19f2bc5a31359f192d5bab34ac7", "_type": "Frame"}, "_selector": "internal:attr=[title=\"Case Handler\"i] >> div >> nth=0"}

I have added a picture, its an IFS System, I tried so many things in last two days but no luck, any help will be appreciated. I am using typescript

Sara
  • 181
  • 1
  • 3
  • 16
  • Look at your parenthesis, you are not calling the method `isVisible()`. Try this: `expect(this.page.getByText('Success!')).isVisible()` – candre Aug 30 '23 at 13:03
  • @candre Its the same after paranthesis Even if the text does not exists on the page it passes. I tired with following locator – Sara Aug 30 '23 at 13:22
  • @candre I tried with following expect(page.locator(('#Form-WorkOrderContactList-fndRow-1-Cf_Contact_Type'))).toBe("Success"); it gives error as follow Expected: "Success" Received: {"_frame": {"_guid": "frame@b4a0f19f2bc5a31359f192d5bab34ac7", "_type": "Frame"}, "_selector": "internal:attr=[title=\"Case Handler\"i] >> div >> nth=0"} – Sara Aug 30 '23 at 13:24
  • Please [edit] the post when you wish to add more code. It's hard to read otherwise. Thanks. That said, without the page and a [mcve], it'll still be very difficult to help. Websites have arbitrary behavior that's difficult to guess blindly. Trying many things is good, but if you don't show each unsuccessful attempt in a complete, runnable manner, it doesn't do prospective answerers much good. – ggorlen Aug 30 '23 at 15:23
  • Is there any way of knowing what is the page? If not, as @ggorlen says, we need more code to know where the problem could be. Or a screenshot of the page. – Jaky Ruby Aug 30 '23 at 16:26
  • @ggorlen I have added a picture now and Formatted the error too – Sara Aug 31 '23 at 12:38
  • Thanks, but I can't scrape a picture. There's still not enough to work off of. I'd have to see the website or a simple reproduction of it that has the same behavior, if you can't share the actual site. – ggorlen Aug 31 '23 at 14:51

0 Answers0