0

I'm new to coding and trying to use Selenium with Python to click through a website and fill a shopping cart. I've got things working well except for the random ForeSee survey popup. When it appears (and it doesn't always appear in the same location), my code stops working at that point.

I read the ForeSee documentation and it says "...when the invitation is displayed, the fsr.r...cookie is dropped. This cookie prevents a user from being invited again for X days (default 90)."

Hoping for a quick fix, I created a separate Firefox profile and ran through the website and got the ForeSee pop up invitation--no more pop up when manually using that profile. But I still get the pop up when using Selenium.

I used this code:

fp = webdriver.FirefoxProfile('C:\path\to\profile')
browser = webdriver.Firefox(firefox_profile=fp)

EDIT: I got the cookie working. I was using the Local folder instead of the Roaming folder in C:\path\to\profile. Using the roaming folder solved the problem.

My question edited to delete the part about the cookie not working:

Can someone suggest code to permanently handle the ForeSee pop up that appears randomly and on random pages?

JRrcgp
  • 15
  • 5
  • Seems like your issue is solved now? – Tarun Lalwani Mar 27 '18 at 20:19
  • it is solved in a quick-fix sort of way. By using the cookie, I need to go to the website manually and run through it before the cookie expires. I don't know when it expires, just that the default is 90 days. Using the cookie to avoid the pop up is better than nothing, but I'd rather know how to identify the ForeSee survey pop up and handle it so that my code goes back to running as if it weren't there. – JRrcgp Mar 29 '18 at 00:50
  • @JRrcgp quite a relevant question: https://stackoverflow.com/q/51978555/771848. – alecxe Aug 23 '18 at 05:49

1 Answers1

0

I'm using using Protractor with JS, so I can't give you actual code to handle the issue, but I can give you an idea how to approach this.

In a nutshell

When following script is executed in the browser's console -

window.FSR.setFSRVisibility(true);

it makes ForeSee popup appear behind the rest of HTML elements. And doesn't affect UI tests anymore

So my protractor script will look like so

await browser.executeScript(
  `window.FSR.setFSRVisibility(true);`
);

Theory

So ForeSee is one of those services that can be integrated with any web app, and will be pulling js code from their API and changing HTML of your app, by executing the code on the scope of the website. Another example of such company is walkme

Obviously in modern world, if these guys can overlay a webpage, they should have a configuration to make it optional (at least for lower environments) and they actually do. What I mentioned as a solution came from this page. But assuming they didn't have such option, one could reach out their support and ask how to workaround their popups. Even if they didn't have such option they would gladly consider it as a feature for improvement.

Community
  • 1
  • 1
Sergey Pleshakov
  • 7,964
  • 2
  • 17
  • 40