Esempio n. 1
0
class GoogleSearch(JythonWebObjectManager):
    """
    classdocs
    """

    browser = None

    def __init__(self, launch=False):
        """
        Constructor
        """
        if launch:
            self.launch()
        if self.browser:
            super(GoogleSearch, self).__init__("Google Search", baseObject=self.browser.browser)
        else:
            super(GoogleSearch, self).__init__("Google Search")
        self.add_items()

    def add_items(self):
        self.addObjectDefinition(
            "Google Search Box", [".class", "regex=(^Html\\.INPUT\\.text|^Html\\.INPUT\\.textarea)", ".name", "q"]
        )
        self.addObjectDefinition(
            "Everything", [".class", "Html.A", ".text", "regex=.*(Everything|Web).*", ".className", "kl"]
        )
        self.addObjectDefinition("Images", [".class", "Html.TextNode", ".text", "regex=.*Images.*"])
        self.addObjectDefinition("Google Home", [".class", "Html.A", ".id", "logo", ".title", "Go to Google Home"])

    def launch(self):
        self.browser = Browser("www.google.com")
        RationalTestScript.sleep(2)

    def close(self):
        self.browser.close()
Esempio n. 2
0
class W3SchoolEditor(JythonWebObjectManager):
    '''
    classdocs
    '''
    browser = None

    def __init__(self, url="http://www.w3schools.com/tags/tryit.asp", launch=False):
        '''
        Constructor
        '''
        if launch:
            self.launch(url)
        if self.browser:
            super(W3SchoolEditor, self).__init__("W3School Html Editor", baseObject = self.browser.browser)
        else:
            super(W3SchoolEditor, self).__init__("W3School Html Editor")
        self.add_items()
        
    def add_items(self):
        self.addObjectDefinition("Input Text", [".class", "Html.TEXTAREA", ".id", "pre_code"])
        self.addObjectDefinition("Edit and Click Me", [".class", "Html.INPUT.submit", ".value", "regex=Edit and Click Me.*"])
        self.addObjectDefinition("Example Drop Down", [".class", "Html.SELECT", ".id", "exampleSelect"])
   
    def launch(self, url):
        self.browser = Browser(url)
        RationalTestScript.sleep(2)
        
    def close(self):
        self.browser.close()
Esempio n. 3
0
 def launch(self):
     self.browser = Browser("www.google.com")
     RationalTestScript.sleep(2)
@author: Jarga
"""
import sys
from com.advancedrft.common.automation.rft import Log
from com.advancedrft.ibminnovate.google.finance import MainPage, CompanySummary
from com.advancedrft.ibminnovate.google.finance.MainPage import IndexName, IndexStatistic
from com.advancedrft.common.automation.rft.object import Browser
from com.advancedrft.common.lang import StringFunctions

if __name__ == "__main__":
    if not sys.argv:
        Log.logError("Must supply a company name.")

    # Open a new browser to the appropriate Google Finance URL
    theBrowser = Browser("http://finance.google.com")

    # Create a new instance of our Google Finance Main Page class
    mp = MainPage(theBrowser)

    # Scrape the current market index chart to the log - We're actually downloading the image file.
    Log.logInfo("Today's market chart", mp.getMarketChart())

    # Collect statistics on the indices.
    # In order to limit and control things better, we made the getMarketSummary() function take two enums.
    # Enums are nice because they let you control how (?)
    for n in IndexName.values():  # @UndefinedVariable - The Java enum values() method is only created at runtime
        logMsg = "".join(
            [
                "<br>" + n.getName() + " today: " + mp.getMarketSummary(n, s) + " " + s.name()
                for s in IndexStatistic.values()
Esempio n. 5
0
 def launch(self, url):
     self.browser = Browser(url)
     RationalTestScript.sleep(2)