Page keeps on loading in Chrome Driver - selenium

I m working on a web application automation and I have this issue with Chrome driver. The page keeps on loading and it does not move to the next action.
For eg: The successful login scenario.
The application is launched and the username passwords are keyed in Successfully and the home page is loaded.
The home page keeps on loading that it does not move to the next button click (eg. log out)
If I manually stop the browser refreshing, it performs the next click but then again the browser keeps on loading.
I have already included
this.driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
I have tried sendKeys(Keys.ESCAPE) too. Nothing seem to work

Related

Python Selenium Safari

I don't understand how this works:
If I open a website by hand in for example Safari or Chrome, I can log me on and if I close the browser I automatically log in after reopen the browser. So I once log in in Instagram, the next time I don't have to do it again if I reopen the side.
But if I open it with selenium, it won't work like this. Is there a way to give options in selenium to fix this? I can't open a side without the side thinks iam a robot (what actually is right) but this sucks...
When you quit the webdriver, the cookies, cache, history, etc are deleted. So if you want to be already logged in when you start the webdriver, you have to use the cookies from a profile on the normal browser in which you are already logged in. To do so you have to:
create a new chrome profile on the normal browser
login to instagram
load the profile in selenium
In this way when you start the webdriver and run driver.get('https://www.instagram.com/') you will be already logged in.
To create a new profile, open your chrome browser, click on the profile icon on top right, then click "Add" and then click "Continue without an account".
Then write a name for your profile and be sure check the box "Create a desktop shortcut". I suggest you to choose a color so that you will immediately see if it works when selenium open the browser window.
Open chrome from the new desktop icon (mine is called "PythonSelenium - Chrome.exe") and login to instagram.
After you logged in, close the browser and open the properties of the new desktop shortcut. Take note of the name of the profile directory, which in my case is "Profile 3".
Now we have to tell selenium to open the chrome driver using this new profile we've just created, which is logged in twitch. To do this we need the path of the folder where the profile is stored. By default the path is something like C:\Users\your_username\AppData\Local\Google\Chrome\User Data, if you are not sure about it check where chrome is installed in your computer.
Then run this code (remember to substitute Profile 3 with the name of your profile from step 3)
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=C:\\Users\\your_username\\AppData\\Local\\Google\\Chrome\\User Data")
options.add_argument("profile-directory=Profile 3") # <-- substitute Profile 3 with your profile name
chromedriver_path = '...'
driver = webdriver.Chrome(options=options, service=Service(chromedriver_path))
driver.get('http://twitch.tv/login') # it should redirect you to the homepage
And this is the result:

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.

How do I detect that SSL is broken on a page, using Selenium

We have pages where we occasionally see compromised SSL certificate because of third party scripts that load non HTTPS resources (Initially they're fine but they occasionally change). We would like to test those pages for broken SSL every day.
We have tried one approach, attempting to catch a pop-up message that would indicate that we have insecure content on the page. However, we have been unsuccessful in simulating the pop-up message through selenium. It appears that selenium has automatically disabled any popups. While we have identified a Selenium method to disable the suppression of the pop-ups(disable-popup-handler) but we have not been able to successfully see the popup even using this method.
Has anyone found a way to detect broken SSL pages using Selenium?
You need to load a browser profile (with WebDriver) that doesn't have the setting for popup blocker enabled (using the Profile class and giving it the right properties). Then, you will get the Windows popup message concerning the SSL cert. If , for some reason, you cannot control the popup using WebDriver (because its limited to Action control only within the browser content window) then you can use Sikuli API to handle the dialog and export the cert to the "Downloads" dir and then copy the file to expected location for inspection. Unfortunately, if you use Sikuli, that will make your automation script sequential and not work via a RemoteWebDriver grid server and so you wont be able to run parallel tests. Hopfully, WebDriver gives you access to the dialog and so you will be able to run with RemoteWebDriver because that is the best way to go when running scripts, even if you run a browser locally.

How do I enable popups in a new Firefox profile using selenium webdriver (Java)

The application I am testing requires pop-up to be enabled. When a launch a new Firefox profile I get the browser message
Firefox prevented this site from opening a pop-up window
with a button on the right called Options. I can manually click the Options button and select to Allow popups from ....
Question is how can I use profile.setPreference to set to allow popups from my website and also not show this Firefox message?
You can save your current Firefox prifile with allowed popups and load it from file like in this case: https://stackoverflow.com/a/6830109/1165331
save you current working profile with popups via browser and loat it.

How Do I Change Firefox Homepage In VB Code

How Do I Change Firefox Homepage In VB2011 Code
I want to change the url homepage of the firefox browser by running that EXE file
is this possible
If you want to change the Firefox's home page form a program running on the user's computer, you have to edit the prefs.js file and create a new line like user_pref("browser.startup.homepage", "http://www.example.com/");.
Beware that if there are multiple browser.startup.homepage entries every entry will be opened in a new tab when the browser starts up, and that the modification must be done when Firefox is closed, otherwise the changes will be lost.