Using selenium in Java to connect to devices and do some clicking. Problem is sometimes these devices lose power and show page not found. I want it to skip those and continue. How do I get it to continue on with the code?
I have tried to have it look at the title but that didn't work.
Related
I am having below error while using google colab on google chrome. It started coming up suddenly
Error
Could not load the JavaScript files needed to display output.
This is probably because your Google Account login access has expired or because third-party cookies are not allowed by your browser.
Please reload this page.
I followed instructions from here using this page as some settings have changed. I have added [*.]googleusercontent.com in the section Sites that can always use cookies using the below instructions
On your computer, open Chrome.
At the top right, click More More and
then Settings.
Click Privacy and security and then Cookies and other
site data.
Next to "Sites that can always use cookies," "Always
clear cookies when windows are closed," or "Sites that never use
cookies," click Add.
Apart from that I have tried below steps:
The google chrome>>incognito mode and firefox browser runs fine.
I have already restarted my machine and cleared my cookies.
My javascripts seem to be enable as they are on the setting Sites can use Javascript
My google account is fully functional and not facing any issues with gmail or any other site
How could I resolve this issue?
Do you have too many cells open on your Colab that aren’t needed? Start a new notebook with just the cells you need or get rid of them.
Solution1: Disconnect your collab runtime and Restart your browser.
Solution2: Clearing cookies of last 24hours (and restarting the system) fixed the issue.
If anyone find any better approach, let me know.
There is an issue opened already https://github.com/googlecolab/colabtools/issues/757
i am using Selenium Webdriver on Java and I am trying to get the network status of every element with a network status like you can see in the image below.
Is there any way to get the status?
Edit:
I guess I cannot upload images. If you press F12 to open the dev-tools there is a network menu. If you click on it, the status of every webelement will show up there.
AFAIK DevTools and Networking tab controls are not natively supported by Selenium.
I have written the Selenium webdriver java code to automate the test and its working fine. But I have lot of data input to test my web and it takes time. So when i minimize the IE to do some other task while it is running the automation, it is throwing error:
org.openqa.selenium.ElementNotVisibleException: Element is not displayed
Selenium WebDriver is trying to simulate "real" users interaction with the webpage. If a person can't click on a button not currently displayed, neither can Selenium.
ElementNotVisibleException occurs when the element you want to interact with is not displayed. When you minimize the browser some of the elements are no longer visible, even though they where in maximized window.
You can add scroll using moveToElement() from Actions class every time you want to perform any action (I don't recommend it, you increase significantly the chance for errors), or find another hardware solution, like plugging in another screen, run the test on another computer etc.
According to my experience, the Internet Explorer WebDriver is very oversensitive when it comes to disturbances from a real user while running test cases. It's better to not touch anything at all. ;-)
Try Chrome! This is much more robust and also faster.
Selenium script runs as a simulator. You cannot do another work when script is running. Chrome is fast but while running script in chrome you can not do other task like any other browser. If you minimize window, you will get exception "ElementNotVisible".
I have a code in selenium which dynamically clicks on the tabs in menu page. And sometimes happens that tab is not clickable(it is just a plain td with span inside) and when Web Driver tries to click on this tab, my program gets frozen (no exception thrown or anything).
I can't avoid clicking on tabs like that but I would like to somehow prevent that freeze after click. So can I set some timeout or tell to selenium what to do if element is not clickable?
driver.findElement(By.xpath(
format("//span[#class='rf-tab-lbl'][text()='{0}']",
navigation.getGroup()))).click();
//if the tab is currently selected (hence is not clickable) selenium won't click
// on it and program freezes
Please try another page from a different website. It might be a JS looping issue.
I encountered such an issue in HtmlUnit for some URLs.
I raised issue in HtmlUnit user group.
They told me that JS infinite loop was causing freez.
Time out did not work for me as well.
I tried to apply my own time out. That did not work too.
Refer following question for applying own timeout
HtmlUnit WebClient Timeout
If it works for another website, problem might be site specific.
You can attach source of Selenium in eclipse and check / debug where it is getting stuck.
I did same for HtmlUnit. I reached to parse method, which did not come out.
If still does not work, contact Selenium support.
I get this error while running selenium RC tests against IE7.
com.thoughtworks.selenium.SeleniumException: ERROR: There was an unexpected Alert! [error:[object Error]]
It happens whenever I attempt to click a link or a tab or anything clickable. Any Ideas guys. This is really frustrating.
Checking the Google search results for your error message, and the selenium development mailing list, it sounds as if this is not a bug in Selenium but rather it is Selenium telling you that an unexpected window.alert() function was called in your web application, and that Selenium does not know how to handle it because you did not tell it how to.
I'd be surprised if the same issue isn't occurring in other browsers. Perhaps your application behaves differently depending on the browser? Basically Selenium is reporting that it can't move onto further commands after you are clicking on these links or tabs because it has detected an unexpected JavaScript alert. You wont see these alerts because Selenium consumes them. There are a few things you can do to work out what's going on.
The first thing I'd suggest is to just check your application in IE7. Manually complete the steps of your tests - do you see the JavaScript alerts? If so, you will need to add the appropriate commands to your Selenium test.
If for some reason you can't replicate the alerts manually you can either dismiss the alert by using the the getAlert command, or use the response from getAlert to find out the text of the unexpected alert.
Java/TestNG example for finding out the message of the alert:
assertEquals(selenium.getAlert(), "Hello World");
The above will still cause your test to fail (unless the alert really does say 'Hello World'), but will fail with a message similar to "expected 'Hello World' but was 'Your unexpected alert message'".
I'm getting a similar thing.
No error in IE, JS error popup in Chrome, nothing in FF...until I run my Selenium script and it reports an unexpected error.
Amusingly when I do selenium.IsAlertPresent() it returns false, even though it says there was one.
I'm seeing the same error. Normally we run our test using C#, but in this case we are setting up some simple tests using the Selenium IDE.
Since Selenium IDE records your events and then allows you to play them back you would expect it to handle the alert. When looking at the events it records it appears it's capturing the alert. However, when you play it back the events are out of order.
First it captures the click event. Then is uses assertAlert to make sure the alert happened.
The problem occurs when you play it back. It does the click event and then errors out. If you move the assertAlert statement before the click event it doesn't work. If you change the assertAlert to waitForAlert that doesn't work either. I can't seem to figure out anyway to get the playback working in the Selenium IDE. If I didn't need this runnable for a non-techy I'd just put it into my regular tests and be done with it.
Edit: After further review it appears the alert message isn't matching. Even though it grabbed the alert itself when doing the record. Visual inspection doesn't do anything to help me determine what it considers different.
I've seen this error also. In my case the issue was the latency in an Ajax response object was causing Selenium IDE error. The solution that worked for me was to add a pause command right after any Ajax calls in the test script.
The call below was taking few seconds to return with valid Ajax response
click
css=#form3 > div.addButton > button.btn.btn-primary
By adding a pause clause, the "Unexpected alert" issue was resolved
pause
5000
I Suggest you to test manually those steps which are there in your selenium test.If it is not reproducible then it might not be the problem in the page.
please debug your selenium script with assert function for identifying where is it finding the unexpected alert.
if (selenium.isAlertPresent()) {
assertEquals(selenium.getAlert(), "Hello World");
}
which will help you identify the problem. I suggest you to repeat the test because you may find that assertion occurring in different part of your code.