Best Buy work schedule Sync


Last Updated: 2012-12-07 22:51:53
  1. PsychoData

    PsychoData Member

    Hey Guys. I am looking at making a app to check my work schedule and place it into a Google calendar. I know some java and I can get my activities to write to a file and such.

    Basically, the parts I'm struggling with are reading from the web page where i get my schedule. I want to work on that first and basically parse the returned website into separate days and hours scheduled.

    I'll upload some screen shots and source code for the web page. Of course, I cannot give you my password and username for you all to test these for yourself, but I have checked and I may let you use the source code.







    Just to give a quick overview of how to use website. I navigate to mytlc.bestbuy.com which redirects me to https://mytlc.bestbuy.com/etm/ once there i must enter my password and username. By hand for now, programmatically later. After that I hit submit and it takes me to https://mytlc.bestbuy.com/etm/login.jsp then I Hit "Work Schedule" which takes me to https://mytlc.bestbuy.com/etm/time/timesheet/etmTnsMonth.jsp and there i can view my schedule. I've posted screenshots and source code of the three steps to get to the work calendar.

    Advertisement
  2. jonbonazza

    jonbonazza Well-Known Member

    Mmkay, I am willing to bet that your calendar is generated via javascript using a database of some sort, which means that it isn't pure HTML. Because of this, you can't really parse the web page. You would need to find out the database information, such as address, username, and password (Which I highly doubt Best Buy would give you) and then perform queries on that database to retrieve the information you need.
  3. StevenHu

    StevenHu Well-Known Member

    If you are not the developer of the database on which your work schedule resides, you won't be able to develop the app. You need to know the passwords, have permission, etc., and you need the field names in which the information is stored. Without that, you can't do anything.
  4. PsychoData

    PsychoData Member

    well i mean i know that best buy isnt going to give me access to this information. but I can see the code that is returned after the javascript is executed. It shows as html tables in the webpage. once i enter the username and password in the field and click the button. then click another button then right click view source it shows in plain html. is there any way to get it?
  5. jonbonazza

    jonbonazza Well-Known Member

    But your app isn't a browser, so you can't just parse the resultant HTML as it will never see the resulted HTML.
  6. PsychoData

    PsychoData Member

    i know the app isnt a browser. but i know that there might be a webbrowser class out there. For instance i am also working on a desktop version of this and vb.net has a webBrowser object. i can tell it to navigate to the site through code, enter my login information programmatically and click the button programmatically. after that I can get a list of htmlElements in the webbrowser object and iterate through those to find what I need.

    WebBrowser Class (System.Windows.Forms)
    this is the vb.net version that i am using. I havent really started looking for a java version yet, but i can probably find something similar
  7. jonbonazza

    jonbonazza Well-Known Member

    There is a WebView class, but using that would have little point as you could just as easily use a browser app.
  8. PsychoData

    PsychoData Member

    well for example i have a computer version working insofar as opening a window, navigating to the page. then the program can get logged in all the way to the calendar and read it no problem just using a getElementByID method.
    A WebView has several customization points where you can add your own behavior. These are:

    Creating and setting a WebChromeClient subclass. This class is called when something that might impact a browser UI happens, for instance, progress updates and JavaScript alerts are sent here (see Debugging Tasks).
    Creating and setting a WebViewClient subclass. It will be called when things happen that impact the rendering of the content, eg, errors or form submissions. You can also intercept URL loading here (via shouldOverrideUrlLoading()).
    Modifying the WebSettings, such as enabling JavaScript with setJavaScriptEnabled().
    Injecting Java objects into the WebView using the addJavascriptInterface(Object, String) method. This method allows you to inject Java objects into a page's JavaScript context, so that they can be accessed by JavaScript in the page.

    So it looks like i could enable javascript which would make it able to at least run the webpage and sign in. I'll have to do more reading on it to see what i could do about loading the values into the fields.

    maybe i could download the html, parse, insert values, render it and then execute javascript and then click the button. idk lots more reading to do and at this point it sounds like even then it would be a popups window that went through these in 10 seconds or so. not something in the background lke i was hoping to make.
  9. PsychoData

    PsychoData Member

  10. jonbonazza

    jonbonazza Well-Known Member

    Yes, but unless you know how to parse the response (which you probably don't have knowledge of), you won't be able to see the results.

Share This Page