Causes of Selenium Chrome to Many Redirects Error When Chrome Works Manually - selenium

I am writing a selenium test which generates to many redirects error; yet, I can manually perform the test. The test fills in a userid and password and presses a login button. I had implemented this test on Chrome 96; however, it doesn't seem to work on chrome 99. I am using selenium 4.1.1. Additionally, the site switched to http/2 during this period. I appreciate any ideas on what the issue might be.

Related

selenium chrome NET BLOCKED BY CLIENT

selenium chrome If a page is not operated for a long time, for example, time.sleep 15 minutes, and then again, it can not open the web page, how to refresh the browser debugging found that it is blocked by client did not install any advertising plug-ins after this situation, if you enter the target URL in a new tab enter, it can be opened normally, who knows the reason? I don't think it has anything to do with cookies, thank you.
chromedriver version is also correct, I do not know if everyone's selenium chrome will not have this problem if the open page time.sleep longer time
***The reason for this is partly to do with the html http-equiv attribute of the target site. If the page does not change for a long time, any further execution of the url of the target site in the same tab will not be considered as "re-fetching from the server" but from the cache, which will cause a js exception. Any subsequent get requests of the xhr type will be directed to chrome-extension://invalid
The value after chrome-extension:// will be BLOCKED by chrome if it is unrecognisable, which will happen in any chrome speculation.
A not-so-good solution is to pywin32 simulate re-opening a new tab by typing in the url, but this causes some tab over-closing and handles switching exceptions, so I'm considering seeing if I can fix this from some chrome option parameter settings***
Also if I don't use selenium chrome but normal manual normal browsing of the target site, I don't manipulate the page for a long time and I don't have the above problem, not quite sure if this is an ISSUE with chrome, don't want to switch to firefox as there is too much code to change.

Firefox stuck at Login operation with Selenium-Webdriver

I'm trying to execute Selenium-webdriver code written in Ruby for firefox.
I'm using firefox 45.0.1 because I use ruby 2.1.10 and Selenium-WEbdriver-2.53.4
When I execute Selenium opens firefox, enters address and enters username and password and hits login button.
But after that It stays there with loading symbol near login and also browser says
Transferring data from 34.23.23.2
Selenium is stuck here for 5 minutes and then exists saying timeout and gives below error.
**1.1) Failure/Error:**
#browser.span(:text=>'Login').wait_while_present(10000)
Net::ReadTimeout:
Net::ReadTimeout
When I manually open firefox new tab when selenium opens the firefox and try to login manually, I see the same issue. But When I open firefox manually from desktop and login it works. Please tell me what I'm I missing here.
I suspect that some websites detect when a automated test is running and behave differently, also when selenium starts up it uses a default profile and when you open it manualy your profile is loaded. Cant say for sure that's your problem.

Getting captcha screen when I execute automation scripts using chrome browser

I have been executing automation scripts for last 6 months without any issues. Suddenly chrome browser shows captcha screen and shows message that please confirm are you human ?.
Below that it states 2 points 1.JavaScript might be disabled 2. your cookies are not supported .I enabled both of the Java script and cookies but no luck.
I tried to execute older version of chrome browser also but I am getting same captcha screen in the older version of browser too.
The good thing is that I am not getting captcha screen in Firefox and edge browser. I am getting it only in the chrome browser.
May I know if chrome has introduced any functionality like if we execute automation scripts and it shows captcha screen because why I am getting this doubt that firefox and edge is not showing captcha screen.

Selenium: Getting 404 error with ChomeDriver browser but not Chrome

I have a weird problem going on with a Selenium test. I have an internal company website that I'm writing a Selenium test for and am getting a 404 error ONLY with the browser instance that Selenium opens up. It doesn't matter if its Chrome or Firefox, I still get the 404.
To prove its only with the browser instance that Selenium opens I have run my test in debug mode, paused it when the browser launches and then manually executed the test case within that browser instance and I always get a 404.
Now, if I open a normal Chrome or Firefox browser instance outside of Selenium I can manually execute the test case just fine.
Manual execution of the test case in Chrome Incognito also works.
What am I missing here?
Apparently something else needs to be loaded with in the browser but I have no idea what. Any help would be greatly appreciated.
I found that we had a redirect problem on our server, however it still doesn't make sense as to why it failed in WebDriver but not in a normal browser. Either way, its resolved.

Chrome Headless - Firefox

I'm working on a monitoring tool for my website to log data. The actual logging is made on server. My goal is to calculate stats based on how long the user stays on the website.
Main question: I used chrome headless command --remote-debugging-port=80. I got logs for up to 10 minutes. Works perfectly. But how long will it work if left working? Is there a default timeout? If yes, how can I change it? If I want to run it exactly 30 minutes after page finished loading?
I'm trying to do the same on firefox (tried using PhantomJS but it wasn't loading the page correctly even though useragent was set to firefox) but firefox just throws an bank page when I'm trying to start a headless mode. I used "firefox -headless" and tried capturing an screenshot. It was just exiting my currently open firefox tabs without capturing any image. Any idea?
Using firefox quantum 59.0. I don't want to use selenium.
Also PhantomJS solution would be great. Currently I just want to collect logs. So, it only have to run all javascript (an jquery) code on the page which then sends the data using ajax. I tried page.onLoadFinished and then a wait function to make it stay on the page for the exact time after page loading.
Since no one answered, I will try to answer my own question after even more research and logical thinking.
Main question: Seems that there is no timeout but if need can be used --timeout X. Even though it's not perfect because it runs independently if the page if fully loaded or not.
As for the firefox, it's buggy. -new-instance (make headless run while you are already on firefox) is not working and -no-remote didn't help. Firefox is only working if running only one instance. So, if it's the PC you are working on and you want to run tests too, firefox is not for you. Headless runs only when no other instances of firefox are running, while chrome runs fine.
PhantomJS didn't work even though tried multiple solutions.
Best solution? Use chrome. Need portable? Use chromium and use headless. Or write your soft to use cefsharp which is based on chromium. Your browser with all libs will be around 120-200MB. Pretty big for portable but do it's work. Same as portable chrome or chromium. CefSharp have a privilege of integrating whatever you like into the browser since it's a... browser.