I automated a web mail application using watin. Usually that web mail application, log off every 15 minutes. So to avoid this, in my code i refresh the browser every 15 minutes so that it never allows the mail to log off. This code works fine with IE8 browser. But I faced 1 problem when I try this code with IE6 and IE7 browsers. After installing this automated application, whenever I try to upload a file using this mail a modal dialog window comes in which we have to select the file(to upload). In that modal dialog window, when I click on browse button it shows ‘Choose file to upload’ dialog and suddenly it closes itself within a second. I don’t know which 1 is blocking this dialog to open. This is the method being used to refresh the browser every 15 minutes:
while (true)
{
ie.Refresh();
Thread.Sleep(899999);
}
Any suggestions or help would be greatly appreciated.
Since it's a web mail application, I assume there's a web page involved?
If so, I would suggest taking that refresh loop out and using the meta refresh tag in the head of that HTML page instead:
<meta http-equiv="refresh" content="900">
That might help.
At the very least, it should tell you if your c# refresh loop is the issue.
Related
I'm using a System.Windows.Forms.WebBrowser control to load a webpage. My understanding is it is just a wrapper around Internet Explorer. I'm therefore struggling to understand why the web page loads ok in a desktop browser (IE 11) but not in the browser control.
The URL has looks as so:
http://subdomain.domain.co.uk/?argumentName=argumentValue
My question is, firstly, is that a valid url (format wise)? Can you have a '?' directly after the '/' as shown? My theory is this could be getting removed behind the scenes when using a desktop browser and not happening when using the browser control. Unfortunately I cannot test that theory as the web page is behind a firewall. At the moment I know nothing else about the location of the web page other than the url.
If that is a valid url, could anyone suggest reasons it would load in IE but not in the web browswer control?
To expand on how its not working, the request times out after 30 seconds. The NavigateError event is raised (status code for me is -2146697211, but that could well be different to status code they get. I cannot find that out until I deploy a dll with some logging info).
The webpage then displays as
I have a selenium automated task setup to login to a website to retrieve some information. It's very basic in the automation. Just logging in and clicking two links. I am running into an issue that is proving to be a problem.
The site in question uses the Authentication Required popup which is not a javascript popup but rather the regular windows auth popup. From what I have read this isn't handled out of the box with selenium.
I am using the "http://Username:Password#url.com" to get to the site but every now and then the site itself has issues on their end where it will prompt me again from username/password randomly. Sometimes I have to enter the username/password twice in a row when navigating there by hand.
Since my task just loops continuously for a few hours picking up the needed info I figured I would just use WebDriverWait to verify an element is present on the page. If the authentication popup appears, the element isn't present. No need to care about this run, so just start over.
The problem I am having is that when the Authentication popup is displayed and I hit my timeout limit I want to close the driver/browser window so that I can start the task over again. However, driver.Close() and driver.Quit() are not doing anything. The browser remains open and the unloaded page is still there with the login popup.
Is there anyway I can force close this? Switch focus to the browser window then force close?
The Alert Method, authenticateUsing() lets you skip the Http Basic Authentication box. The below code was tested on Google Chrome in java.
Alert alert = driver.switchTo().alert();
alert.authenticateUsing(new UserAndPassword(Username, Password));
In case it doesn't work and you might want to try this:
https://stackoverflow.com/a/40757504/7071055
I am working on web site scraping project where I am using webbrowser control in C#.net
I almost done these by going from page to page and collecting data.This project has to run automatically.
One page has JavaScript function and there is alert message notification is popping up. How I can pass this alert?Is there any way to comment it out or call click method?
Please help with this.
Thank you in advance
I am using Kendo UI Asp.Net MVC4 Q2 2013 everything is working fine on local but when i am deploying it on IIS server it stop insert\update on DB and nothing happening event not throwing any error.
as pwdst mentioned, the best way to start debugging this is to look at the web page interaction with your server using the browser's debugging tools. You're looking for the web page requests back to the server. Following is example of how to do this in IE using my jsfiddle example page. In this sample the grid is asynchronously loading data from the server. This sample uses Jsfiddle's ability to simulate ajax requests (the POST request to jsfiddle's /echo/jason URL, which will simply reply back with the json data that we send it.)
read: {
url:'/echo/json/',
type:'POST',
data: {
json: JSON.stringify(testdata)
}
}
When the browser is started, click F12 to start developer tools. This will open a new "Developer tools" window.
Click on the Network tab (this varies by browser version), and then click on the "Start" button to start the network trace.
Select the browser's normal page window and start the target page (or hit F5 to refresh it).
Select the browser's "Developer tools" window and observe the network requests sent to the server. You can double click a specific request to see the details. The problem is probably that the request is being sent to the wrong URL.
Is this possible? i have an exit button on my web application, originally, my client request that once they click the exit button, it should CLOSE the tab or the browser itself but afaik that's impossible since the web aplication can be opened via link in an email (outlook,yahoomail etc) via tag, so I suggested this alternative to simply just redirect to the Home (of the user, not the web app). the problem how to Redirect to USER's home page. TIA
if (window.home){
window.home();
}else{
window.location='about:home';
}
Something like that would be my guess.
window.home() reference.
There is no way to detect user's existing settings for a home page. This is a security issue. You can always, however, close the browser window after the user is finished using your application.
JS: window.close();
Not sure that would be advisable (even if it were possible), as users can have multiple homepages. Usually, web applications have a log-out button which would log the user out and return to the application's main page (probably showing a log-in form).