Bowser disable cross domain cookies in Firefox for opening Visualforce page in an automated browser - automation

I am trying to open a Visualforce page in Firefox using an automation tool (Web driver). While trying this, every time automated browser open the VF page it shows:
We can't display this page because your browser blocks cross-domain
cookies. Try again with a different supported browser.
How to run automation test script for the VisualForce Pages?

Related

Using tabCapture in headless browser

I have created a web extension that uses the tabCapture API to record the browser navigation. This extension stops working (i.e., the browser is not recorded) when using a headless browser (i.e., when using the --headless argument and an automated test with Selenium).
Is there any option to use the tabCapture API in a headless browser?

Allowing 3rd party cookies in Chrome Webdriver configuration

here's the situation: I load a website A in incognito mode using Selenium Chrome Webdriver. In this website there is a iframe loading information from website B. Chrome Incognito mode blocks the iframe contents because treats it as a 3rd party cookie.
If I allow the cookies from the website B the conents of the iframe show up. If I don't use the incognito mode the contents also show up. However, after manually allowing cookies in Chrome setting it only works during this session. And I need the incognito mode in other tests so I don't want to change configuration between the tests.
Is there a way to set up the Webdriver to allow the cookies from the 3rd party website?

How do I bypass the login page when I am testing Salesforce Lightning using Selenium Webdriver?

I am testing Salesforce Lightning pages on Chrome using Selenium Webdriver code that's in a C# NUnit project in Visual Studio 2019. I get the Login page every time I run a test.
I used to get the Verification page after the login page but after I added the IP address of the Chrome browser to the list of trusted addresses as recommended here,
How to Automate the salesforce login OTP feature using selenium WebDriver?
the verification page is not coming up anymore.
When I test Salesforce using UFT or Selenium IDE, the login page never comes up.
As can be seen in the attached image, I even have the "Remember Me" checkbox checked.
How can I stop the login page from coming up when I am testing Salesforce Lightning using Selenium Webdriver?
Also, how can Selenium recognize Javascript popups on the page like the Allow Notifications popup in the image below?

Change WebDriver from GUI to Headless

I want to automate an application for an upload process with selenium.Therefore I am using geckodriver. Right now I am doing the login site headless but I want to do the login by the user and then change to headless. Is there a way to do that or at least a work around?
There is no way to do that using the same browser instance... The headless flag is a setting passed to the browser on startup and there is no way to dynamically change that.
If the site uses cookie-based authentication, here is an alternate approach:
login with browser in normal (GUI) mode
export saved cookies
instantiate a new browser in headless mode
navigate to the site again with the headless driver
add saved cookies to the new headless driver
... at that point, you can navigate to an authenticated page. You should be "logged in" since you are re-using the cookies from the original browser session.

Opening Selenium in a Iframe

I am using selenium to perform screen scraping on some application(url).I am using IE/Firefox driver.Can we open the browser which selenium opens in an iframe instead of opening it in a new window.To be more precise driver.get should open the url in an iframe and not a window.
No. You can't open a browser inside an IFRAME. The contents of an IFRAME are always displayed by the same browser that displays the IFRAMEing page.
How to work around this strongly depends on what you are trying to accomplish and on whether you are using Selenium 1 (a browser plugin that rewrites pages by injecting JavaScript into them) or Selenium 2 (which uses WebDriver to communicate with browsers). But I'm pretty sure you'd need to rewrite some of the Selenium software.