Skip to content

Instantly share code, notes, and snippets.

View AlonaPF's full-sized avatar

Alona AlonaPF

  • Property Finder
  • Dubai
View GitHub Profile
@AlonaPF
AlonaPF / Appium.txt
Last active October 10, 2019 11:24
Appium logs
The server is running
[HTTP] {}
[W3C (2e4a218a)] Calling AppiumDriver.click() with args: ["29da9a26-637d-41f5-ac1b-f4a40bbc2761","2e4a218a-3364-4c4a-9715-7485dbce1c9e"]
[WD Proxy] Matched '/element/29da9a26-637d-41f5-ac1b-f4a40bbc2761/click' to command name 'click'
[WD Proxy] Proxying [POST /element/29da9a26-637d-41f5-ac1b-f4a40bbc2761/click] to [POST http://localhost:8200/wd/hub/session/7d236c89-9c1b-4f02-9be1-ed9234ac6ddd/element/29da9a26-637d-41f5-ac1b-f4a40bbc2761/click] with body: {"element":"29da9a26-637d-41f5-ac1b-f4a40bbc2761"}
[WD Proxy] Got response with status 200: {"sessionId":"7d236c89-9c1b-4f02-9be1-ed9234ac6ddd","value":null}
[W3C (2e4a218a)] Responding to client with driver.click() result: null
[HTTP] <-- POST /wd/hub/session/2e4a218a-3364-4c4a-9715-7485dbce1c9e/element/29da9a26-637d-41f5-ac1b-f4a40bbc2761/click 200 72 ms - 14
[HTTP]
require_relative '../spec_helper.rb'
class BasePage < SitePrism::Page
include SitePrism::DSL
@@selector = { ANDROID: :id, IOS: :predicate }
def self.get_default_selector(platform)
if platform.downcase == 'android'
return @@selector[:ANDROID]
elsif platform.downcase == 'ios'
#inherited DSL module
Include SitePrism::DSL
#single
def self.element(name, *find_args)
m_find_args = find_platform_locator(*find_args)
super(name, *m_find_args)
end
#multiple elements
def self.find_platform_locator(*find_args)
platform = ENV['PLATFORM'].upcase
#If Android - it will remove second element and use 1st as a locator in a test
if (find_args.length == 2) && (platform == 'ANDROID')
find_args.delete_at(1)
#If iOS - it will remove first element and use second as a locator in a test
elsif (find_args.length == 2) && (platform == 'IOS')
find_args.delete_at(0)
def self.set_default_selector(android, ios)
@@selector = { ANDROID: android, IOS: ios }
end
@@selector = { ANDROID: :id, IOS: :predicate }
#after adding variable modification
def self.get_default_selector(platform)
if platform.downcase == 'android'
return @@selector[:ANDROID]
elsif platform.downcase == 'ios'
return @@selector[:IOS]
else
raise ArgumentError, 'Wrong Platform name'
def self.get_default_selector(platform)
if platform.downcase == 'android'
return :id
elsif platform.downcase == 'ios'
return :predicate
else
raise ArgumentError, 'Wrong Platform Name'
end
end