Accessing HTML table contents via AppleScript or JS

Is there any provision for accessing HTML elements via AppleScript or JavaScript in EPP? I need to search a web page in FireFox and return the contents of a cell in a table.

Any suggestions?.. Not much an AppleScript dictionary available in FireFox.

Comments

  • JonathanOSXJonathanOSX ForumAdmin admin
    You can go two ways with this in Eggplant. The first would be to script against the SUT's browser the way a user might inspect for an HTML element. Something along the lines of
    • View -> Page Source
    • Search for String
    • etc[/list:u]
      Although completely doable this probably takes you into testing areas of the browser that are beyond the scope of what you really want to test (unless you are testing the browser itself).
      NOTE: Safari actually has some great built in features for this by exposing the debug menu using this command
      default write com.apple.safari IncludeDebugMenu -bool TRUE
      

      However, sometimes an easier way to access this data is to pull it from the website directly in SenseTalk and inspect it in an Eggplant script. This is usually as easy as
      put url ?http://www.somewhere.com/somepage.html? into 
      htmlContents
      
      You can use all of the SenseTalk chunk expressions. At this time there aren't any special commands for parsing HTML/Javascript into a DOM from the source but you should be able to scan/search for what you need.
      For more information about this refer to Chapter 15 of the SenseTalk reference manual.
  • Thanks Jonathan.

    I'm trying to work something out using the html, but it's all posted dyanamically, so I can't use putURL for this. More than likely, I'll get the sorce and search through it.
Sign In or Register to comment.