I am seeing a very odd thing happen with kendo UI's kendoUpload. I have implemented a custom UI for displaying the files being uploaded, along with a progress bar and a cancel button. Kendo does not offer an API for cancelling uploads, but I read here that you can tap into kendo's default upload progress display to cancel an upload. That is exactly what I did, with the following javascript function attached to my custom cancel button:
var fileName = _getFileNameForThisCancelButton();
var kendoUpload = $('#file_upload').data('kendoUpload');
if (kendoUpload) {
var cancelButton = kendoUpload.wrapper.find('ul.k-upload-files')
.find('.k-file:has([title="' + fileName + '"]) .k-cancel');
cancelButton.click();
}
This little function works as far as it does fire the kendoUpload's cancel event, and the network traffic stops, so data is apparently no longer being sent from the browser to the server.
However, as soon as one cancel button is clicked, any subsequent requests to the site from the browser where the cancel button was clicked hang forever. Note this is for the entire site, not just the file upload page, and only for the browser in question -- the site still loads in other browsers where upload cancel buttons have not been clicked. This goes for Chrome 30.0.1599.69 m, Firefox 20.0, and IE8.
With Firefox and IE, simply closing and restarting the browser causes the hanging to stop, and the site loads again. With Chrome I have found this doesn't work, and neither does logging out of my local machine -- I have to do a full reboot to get the site to load again in Chrome. I think this may have something to do with my Chrome settings though. I have it set up to load all of my last tabs when re-opening, and I have noticed that closing and re-opening Chrome also does not delete my login cookie for the site. Either way, It's the same issue even if it is harder to reset in Chrome.
So... any ideas what is going on here? It seems almost as if the browsers are still waiting for a response from the server for the cancelled upload and blocking on the entire site waiting for a response that will never be delivered.
Updates
Turns out I was right about Chrome. After disabling the "Continue where I left off" startup option, Chrome now behaves the same as FF and IE -- need to close and reopen the browser to get the site to load again.
I have also tried this without the custom UI, meaning I turned off showFileList: false when creating the widget and clicked the actual cancel button. Starting to wonder if this has anything to do with the POST method on the server...?
Related
I am working on an application which supports only Edge Browser.
The login functionality works as follows -
On the login screen, when username and password values are provided and login button is clicked, a new browser window opens with an active alert pop-up saying Login Successful along with OK button similar to the image below -
Also, when this new window opens, the old browser window goes blank.
When user clicks on this OK button (or hits ENTER button on keyboard), user home page loads on this new browser window itself and the old window remains black throughout the session.
Automation -
To handle this flow in automation, I have used getWindowHandles() method where I get the handle of this newly opened window and accept the alert.
This used to work properly till edge browser version 105.
However, when the edge browser version was upgraded to 107, I started facing the issue where the getWindowHandles() method goes into infinite loop and eventually the test times out.
I also tried to simulate ENTER button hit by using Robot class but it made no difference.
I have tried using the edge-driver version matching with the current browser version 107 but the issue persists.
Can someone please let me know what can be done for this? Is these any known issue with newer edge browser version?
Thanks in advance..!!
This is the code written to handle multiple windows and the test times out at getWindowHandles() method itself.
for(String wh : driver.getWindowHandles()){
driver.switchTo().window(wh);
}
Adding a Wait may be the key to this problem:
WebDriverWait wait = new WebDriverWait(driver,20);
BTW, I've tested in Edge 108 (also with Edge Driver 108). There's no such error message and everything works great. You can upgrade to 108 and see whether this issue has been fixed.
I am using selenium automation in Safari. It seems there is an issue in using driver.navigate.back()
So I used:
((JavascriptExecutor)driver).executeScript("history.back")
((JavascriptExecutor)driver).executeScript("history.go(-1)")
But this code is going to the previous page and not actually clicking the browser back button. I confirmed by doing manually. If I do manually in my application, it will pop up a dialog saying "do you want to leave this page?" But with this code it's not happening.
Based on this open issue, it seems Safari reloads an old page. It doesn't fully initialize the extension for the page.
Hence Selenium does not support it:
safaridriver.inject.commands.unsupportedHistoryNavigation = function() {
throw Error('Yikes! Safari history navigation does not work. We can ' +
'go forward or back, but once we do, we can no longer ' +
'communicate with the page...');
};
I'm using Selenium Web driver for testing, but can't ecen get past login page. The code I'm using:
driver.Navigate().GoToUrl(baseURL + "URL");
driver.FindElement(By.Id("loginForm:username")).SendKeys("uName");
driver.FindElement(By.Id("loginForm:password")).SendKeys("pass");
driver.FindElement(By.Id("loginForm:login")).Click();
Element locators are correct and login click is happening, but after that I am not logged in, but page is just stuck there - no error or something. Same code worked in IDE.
I'm using IE9 and also there is changed settings:
var options = new InternetExplorerOptions();
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
driver = new InternetExplorerDriver(options);
Any advices how to overcome this problem?
This happens with me very often, but not sure if it is the same reason for you.
When you run the tests locally, all the actions (sendkeys, click etc) take place really quickly. The loginForm:login button could be kept disabled until the user enters text in fields loginForm:username and loginForm:password. So there is a possibility that the button loginForm:login could have not been active when it is being clicked.
So I would recommend using an explicit wait to check if the element id loginForm:login is displayed before clicking it.
This step is basically useless but all it does is simply waste some time between "sending keys" to the password text box field and clicking submit.
Also for a quick check you could also do something similar to sleep 2 (make the script sleep for 2 seconds) after entering the password and before clicking the login button.
IF you eventually plan to run this on a remote machine, you dont need to do any of the above two steps, the time delay due to communication between the machines will be sufficient for the whole process to work smoothly.
(The same problem occurs on the linkedin login page- Login button is disabled unless Username and password is entered, but the speed at which the webdriver performs each step, The login button is not active when being clicked on.)
Several of my vendor's require me to place orders thru their websites. I have automated the process by clicking on a button in my order processing program. My program will open the default browser (now IE 9 after my previous computer died), navigate to the vendor's website order page, fill out the information fields, and then click the form submit button.
this.oIE.Document.all.ctl00_MainContent_Login1_LoginButton.click()
or
this.oIE.Document.getElementById("ctl00_MainContent_Login1_LoginButton").click()
The problem appears to occur only when the button has an "onclick" value.
In IE8, the click() event executes the onclick code. In IE9, the click event returns a generic object. It does not fire the onclick code.
I have tried x.FireEvent("click"), but this returns an object as well. It appears that IE9 DOM onclick values cannot be executed by external programs.
My program works fine on IE8 (I use Chrome, IE, FireFox with different settings and logins, so changing the default browser is not really an option. Also, some of my vendors demand that I use IE as their sites are broken on the other browsers.)
Any advice on a permanent fix for this would be appreciated.
I could have written your question verbatim, and have been fighting this for as long as you have.
Stupid, stupid problem: The click() function now requires a parameter: click(1)
w = this.oIE.Document
z = w.getElementById("btn-header-input-signin")
z.click(1)
Haven't thoroughly tested this, but it works on the US Postal Service login page.
The function that the button click calls will presumably have the same name on each browser. Can you call that function instead?
Simulating the button click seems an unnecessary step. Also, have you tried jQuery? Libraries like that try to smooth away browser differences.
Using Safari browser and finding one hurdle to making it my default browser - there is no default setting for clearing/deleting all the stuff you find in the menu's Reset Safari panel.
I made an Automator routine using the 'Watch Me' to do this and quit safari - it works. But, I'd really like to not have the steps display while it's running. The show actions is not selected but, they still show.
I tried creating a script but Safari dictionary does not have the option for Reset (or any of the reset panels items...)
So, how can I accomplish this?