Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Add selectors for iOS and android ui automators #200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions selectable.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ func (s *selectable) FindByID(id string) *Selection {
return newSelection(s.session, s.selectors.Append(target.ID, id).Single())
}

//Find by android ui automator
func (s *selectable) FindByAndroidUIAutomator(selector string) * Selection {
return newSelection(s.session, s.selectors.Append(target.AndroidAut, selector).Single())
}

//Find by iOS ui automator
func (s *selectable) FindByIOSUIAutomator(selector string) * Selection {
return newSelection(s.session, s.selectors.Append(target.IOSAut, selector).Single())
}

// First finds the first element by CSS selector.
func (s *selectable) First(selector string) *Selection {
return newSelection(s.session, s.selectors.Append(target.CSS, selector).At(0))
Expand Down Expand Up @@ -142,6 +152,16 @@ func (s *selectable) FirstByClass(text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Class, text).At(0))
}

//FirstByAndroidUIAutomator finds the first element given by the ui automation expression.
func (s *selectable) FirstByAndroidUIAutomator(selector string) * Selection {
return newSelection(s.session, s.selectors.Append(target.AndroidAut, selector).At(0))
}

//FirstByIOSUIAutomator finds the first element given by the ui automation expression.
func (s *selectable) FirstByIOSUIAutomator(selector string) * Selection {
return newSelection(s.session, s.selectors.Append(target.IOSAut, selector).At(0))
}

// All finds zero or more elements by CSS selector.
func (s *selectable) All(selector string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.CSS, selector))
Expand Down Expand Up @@ -183,6 +203,16 @@ func (s *selectable) AllByID(text string) *MultiSelection {
return newMultiSelection(s.session, s.selectors.Append(target.ID, text))
}

//Find by android ui automator
func (s *selectable) AllByAndroidUIAutomator(text string) * Selection {
return newSelection(s.session, s.selectors.Append(target.AndroidAut, text).Single())
}

//Find by ios ui automator
func (s *selectable) AllByIOSUIAutomator(text string) * Selection {
return newSelection(s.session, s.selectors.Append(target.IOSAut, text).Single())
}

// FirstByClass finds the first element with a given CSS class.
func (s *selectable) FindForAppium(selectorType string, text string) *Selection {
return newSelection(s.session, s.selectors.Append(target.Class, text).At(0))
Expand Down