Hi Brandon_Hein, sorry about that. I’m trying to close the Pop up notification and click on the ‘Not Now’ button. I’ve tried to locate the xPath of ‘Not Now’ and click on it so that it will close, but it didn’t work. I’m getting error “Unable to locate element”. Not sure if my xPath is wrong. Please help.
Do you need to? Probably not. Would it be a good idea? Probably. It basically narrows down your search to only elements that live within that dialog. If you left it off, and just did:
//button[text()=“Not Now”]
it would probably still work fine, but it’s less safe. What if, for whatever reason, there was another button with that text somewhere else on the page? Putting the parent element just makes it a more precise locator.
Right, the 5 is a timeout argument. Lets say that that element NEVER appeared. Would you want the code to sit there and wait forever? Probably not. So we give it a timeout, which basically says “if the condition isn’t met within x seconds, move on”.