private String getElementPath(FragmentCreateData.MoodField mood) { switch (mood) { case FragmentCreateData.MoodField.M_3: return("//div[contains(text(), '-3') and @class='mood-number']"); case FragmentCreateData.MoodField.M_2: return("//div[contains(text(), '-2') and @class='mood-number']"); case FragmentCreateData.MoodField.M_1: return("//div[contains(text(), '-1') and @class='mood-number']"); case FragmentCreateData.MoodField.M_0: return("//div[contains(text(), '0') and @class='mood-number']"); case FragmentCreateData.MoodField.M1: return("//div[contains(text(), '+1') and @class='mood-number']"); case FragmentCreateData.MoodField.M2: return("//div[contains(text(), '+2' and @class='mood-number']"); case FragmentCreateData.MoodField.M3: return("//div[contains(text(), '+3') and @class='mood-number']"); } return("//div[contains(text(), '0') and @class='mood-number']"); }
private void setMood(FragmentCreateData.MoodField mood) { manager.driver.FindElement(By.XPath(getElementPath(mood))).Click(); }