• Post Reply Bookmark Topic Watch Topic
  • New Topic

Progress bar not working  RSS feed

 
Foni kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Experts,

I am creating an automation utility using selenium in java to read data from excel (with 100 records) and populate in a text box on a webpage textbox. It is working well but my only question here is I need to show up this whole process in a progress bar. Suppose there are 100 records to be updated so when the progress bar starts it should show 0 and then on completion of 50 records it should show 50% , on 75 records it should show 75% like wise and then on completion of 100 records it should show a 100%.

Below is my code am using for updation of company_names and company_location to the webpage text-box from the excel-sheet. But I want to show this using progress bar as the process progresses.(10%,20%,30% and so on). Right now the progress bar which i have created shows the progress from 0 to 100 once the updation is over but i want it should show in a format like if 20 records are updated then 20% , if 30 records are updated 30% and so on. Can anyone please suggest me where i need to modify the below code to rectify this issue?

Can anyone suggest me a way to achieve this.

Appreciate for all your help in this regard.

CODE IS PASTED BELOW:

 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1103
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Deeb,
Your way of implementing progress bars is wrong. Please check the tutorial page which explains how to do it.
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
write this inside the first for loop..



Remove second for loop. No need of that..

(Here 100 means the maximum value of the progressBar)
 
Foni kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramesh Pramuditha Rathnayake wrote:write this inside the first for loop..



Remove second for loop. No need of that..

(Here 100 means the maximum value of the progressBar)



Hi Ramesh,

First of all thank you for the valuable suggestion,now my progress bar works but the only thing is suppose there are 5 records to be updated , it stops at 80% rather than showing 100% and says a message which I have set "All records has been updated"


In my excel sheet I have my data from second row onwards , and my for loop i starts from 1 so is this the reason for the issue i am facing. please advice.
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deeb kumar wrote:... there are 5 records to be updated , it stops at 80% rather than showing 100% and says a message which I have set "All records has been updated"


In my excel sheet I have my data from second row onwards , and my for loop i starts from 1 so is this the reason for the issue i am facing. please advice.


I saw a big problem in your for loop.
Please observe it carefully..!!
 
Foni kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramesh Pramuditha Rathnayake wrote:
Deeb kumar wrote:... there are 5 records to be updated , it stops at 80% rather than showing 100% and says a message which I have set "All records has been updated"


In my excel sheet I have my data from second row onwards , and my for loop i starts from 1 so is this the reason for the issue i am facing. please advice.


I saw a big problem in your for loop.
Please observe it carefully..!!



Can you please tell me what is the issue about the for loop do you mean to say i<=s.getrows() ? Please advice
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you said that your first data is not showing in your sheet, your problem is not there.
You have to start i from 0. The Index of the first data is zero..
Then you have to change progressBar code as below..

 
Foni kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramesh Pramuditha Rathnayake wrote:As you said that your first data is not showing in your sheet, your problem is not there.
You have to start i from 0. The Index of the first data is zero..
Then you have to change progressBar code as below..




Thanks Ramesh! Yes that was the reason for the issue and it all got fixed now. Cool and thanks again
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!