<commit_before>module Gridium
  class Page

    def initialize

    end

    def self.switch_to_frame(frame)
      Driver.driver.switch_to.frame(frame)
    end

    def self.switch_to_default
      Driver.driver.switch_to.default_content
    end

    def self.assert_selector(by, locator)
      asserted_element = Element.new("Asserted Element", by, locator)
      unless asserted_element.enabled?
        fail("Could not find element on page with locator #{locator} using #{by}")
      else
        Log.info("Asserted Element present with locator #{locator} using #{by}")
      end
    end

    def self.has_css?(css, options={})
      begin
        Driver.driver.find_element(:css, css).enabled?
      rescue Exception => e
        return false
      end
    end

    def self.has_xpath?(xpath, options={})
      begin
        Driver.driver.find_element(:xpath, xpath).enabled?
      rescue Exception => e
        return false
      end

    end

    def self.has_link?(linktext)
      begin
        Driver.driver.find_element(:link_text, linktext).enabled?
      rescue Exception => e
        return false
      end
    end
<commit_msg>changed syntax of assert_selector slightly<commit_after>module Gridium
  class Page

    def initialize

    end

    def self.switch_to_frame(frame)
      Driver.driver.switch_to.frame(frame)
    end

    def self.switch_to_default
      Driver.driver.switch_to.default_content
    end

    def self.assert_selector(by, locator)
      asserted_element = Element.new("Asserted Element", by, locator)
      if asserted_element.eql? nil
        fail("Could not find element on page with locator #{locator} using #{by}")
      else
        Log.info("Asserted Element present with locator #{locator} using #{by}")
      end
    end

    def self.has_css?(css, options={})
      begin
        Driver.driver.find_element(:css, css).enabled?
      rescue Exception => e
        return false
      end
    end

    def self.has_xpath?(xpath, options={})
      begin
        Driver.driver.find_element(:xpath, xpath).enabled?
      rescue Exception => e
        return false
      end

    end

    def self.has_link?(linktext)
      begin
        Driver.driver.find_element(:link_text, linktext).enabled?
      rescue Exception => e
        return false
      end
    end

{'fraction_non_alphanumeric': 0.08684324793747286, 'fraction_numerical': 0.0, 'mean_word_length': 2.4183976261127595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3159395', 'n_tokens_mistral': 679, 'n_tokens_neox': 674, 'n_words': 175}