I'm working on an Automation project using TestNG. I have created a Listener that updates a HTML file every time there is a test passed/failed/skip etc.
The only issue I have is that if I want to see these changes I have to manually refresh the HTML page.
Is there any code I can use within Java to automatically refresh a HTML page whenever a change is made to it or just refresh every second once the program is running?
EDIT: Seen that its mostly javascript this is done through so some advice on how to integrate JS into my Java class would be beneficial also, thanks.
Related
I am trying to write a JS script to automate some work process. What I am trying to have my JS do is first enter the account number and then click on the search button. What this does is populate the account info below the search field. However the issue is that it simply just reloads the page with the populated info. My JS recognizes the page load and starts the process all over and searches the same account number creating an infinite loop. Is there a way I can have my code recognize that the search button has been clicked and we do not have to click it again on the new page load?
I am having the code run on page load and maybe that's not the way to do it? I am using Tampermonkey in chrome.
Thanks in advance.
If you created a variable, it may loop itself constantly. Make sure the variable is not always active.
I´m building a application that takes a picture from the webcam in certain interval of time. Basically i'm calling a js function that takes the snapshot time to time,the js is triggered by a click event in a jsp page, to start the function.
Can i keep the js running when i´m switching between jsp pages? Is that possible?
A page reload resets the state.
Given the limited problem description, I would say use Ajax - define a button onclick event, in which take the picture then submit it via Ajax.
If you use a form-based upload, you can submit a form without reloading the page.
If this doesn't suffice have a look at How to upload photos using web app.
I was doing a rails project and I added a small piece of 3rd party javascript which generated a button to my html.erb file in view, then I deleted it. However, the javascript (of course the button) keeps loading even if the source code didn't have that block. And more, whenever I created a controller/action, when I visit the page, the button will show up. Could anyone help me with that?
It's hard to help without seeing the code/error.
But I would recommend either:
Removing the javascript gem.
Searching and deleting the javascript.
First I am new to the asp .net world and am trying to figure out a weird issue that I am having. Any suggestions or comments are welcome.
I have a page that has a form and on submit I launch another aspx file that exists in the same directory.
The problem is the aspx file is shown and the file closes immediately!.
Howewever, the weird part is if I make any modifications to the aspx file and save it and then run my application it works fine ONLY THE FIRST TIME!? any subsequent submit actions launch the aspx page but then the aspx file immediately closes.
But after I make some modifications to the aspx file..(simple ones) it launches correctly the first time.
I realize that this is very little info to go on and I am not even sure if I have got my point across...but any suggestions on how to debug this will be helpful.
We are targetting .net version 4.0 and using IIS7.
I am thinking that the asp worker process is doing something weird like checking for timestamps and closing it?! Not sure tho.
Any help is appreciated.
ASP.Net webforms don't use the form in quite the same way as regular HTML forms. All you need in your form tag is
<form runat="server">
If you want to pass the user onto another aspx page you can use the Response object:
Response.Redirect("~/pages/SomeOtherPage.aspx");
or (Server.Transfer - read up on the differences)
Server.Transfer("~/pages/SomeOtherPage.aspx");
If you want to open a page in a new/pop-up window or similar you'll need to do so using JavaScript
window.open('/pages/SomeOtherPage.aspx') [There are overridden versions of this method]
You can use the forms PostbackUrl property too, but this will also keep the user in the same browser window. More info here.
HTH
I was searching for a script or at least a code snippet but haven't really made any progress. Anyway, I'm looking for a script that works like a simple pagination javascript but it should be accessible by linking from anywhere in the document and by calling it with the URL (e.g. on www.abc.de/default.html#thirddiv the third page of the pagination is displayed). Further, the contents should be loaded upon request (when the user clicks on the link and enters the specific page of the pagination), so that cookies, that have been set or deleted in the same document earlier can be used later without reloading the entire page. Something like that is used on Facebook for calling contents and loading them.
I've found a script on CSS Tricks called BetterBlogroll but I don't really get my mind into this. A pagination script from DynamicDrive is already working very well on the page but my problem is that there should be running three of them on the same page and as I said, the content should be loaded upon the user's request.
The script I'd need does not has to be with loads of CSS, the best way would be plain javascript and only the required CSS and HTML data. Anything else just disturbs. If anyone can help me out here, I'd be very thankful.
Check out Ryan Bates's Railscasts #174 and #175. These two are not rails specific, and explain this well.