• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threading help required

 
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. I am new to threads so can you please provide changes in my existing codes using threads.

Appreciate for all your help in this regard.

CODE IS PASTED BELOW:

 
Paul Clapham
Sheriff
Posts: 21153
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your processing of those 100 rows really so slow that displaying a progress bar is a practical thing? I would have thought it should only take a fraction of a second. Progress bars are only useful for a process which takes much longer than a second.

And I'm confused by your mention of "web page text boxes" when the code you posted uses a JFrame. Those two things are not really compatible.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And besides that, the general principal with keeping your progress meter up to date would be:


The way you are doing it is

In this scheme, the progress can't be updated as the work is being processed because you don't start the progress updates until after the work is complete.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Is your processing of those 100 rows really so slow that displaying a progress bar is a practical thing? I would have thought it should only take a fraction of a second. Progress bars are only useful for a process which takes much longer than a second.

And I'm confused by your mention of "web page text boxes" when the code you posted uses a JFrame. Those two things are not really compatible.

Selenium is a web browser automation tool. The unit of work could take a while because it requires round-trip communication with a foreign web site. The 'web page text boxes,' I presume, are being filled with values by selenium, and are not part of the local application/JFrame. So for example, it looks like his Java application has a JFrame with some status and progress bar. It then uses selenium to open firefox to a web app, and then automates filling in the forms on that site.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic