lib/applenium/methods/web_methods.rb in applenium-0.0.2 vs lib/applenium/methods/web_methods.rb in applenium-0.0.3
- old
+ new
@@ -1,34 +1,69 @@
\ No newline at end of file
+require 'net/https'
+require_relative 'required_files'
+
+
+def visit(page)
+ $driver.get(page)
+end
+
+def click(locator_type, locator_name)
+ WAIT.until { $driver.find_element(:"#{locator_type}" => "#{locator_name}") }.click
+end
+
+def displayed(locator_type, locator_name)
+ WAIT.until{ $driver.find_element(:"#{locator_type}" => "#{locator_name}") }.displayed?
+end
+
+# method to validate dropdown selector
+
+def check_element_on_page(locator_type, locator_name, scenario)
+ if scenario
+ if !displayed(locator_type, locator_name)
+ raise Failure, 'Element Not Present'
+ end
+ else
+ begin
+ if displayed(locator_type, locator_name)
+ raise 'Present'
+ end
+ rescue Exception => e
+ if e.message == 'Present'
+ raise Failure, 'Element Present'
+ end
+ end
+ end
+end