When I run my app in Apium, I am able to login successfully. After login there is a coachmark to help first time users. I am not able to dismiss this coachmak using Apium methods. I have tried multiple methods as follows -
(1) Thread.sleep(5000);
(2) WebDriverWait wait = new WebDriverWait(driver, 15, 3000);
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(xPath)));
(3) findElementByXPath and findElementById both
The error I am getting is this:
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
This is what my method looks like:
@Test
void logInBeforeOtherTestcases() throws Exception {
// LogIn login = new LogIn();
if (readFile(ExcelFilePath, ExcelTestSuite, ExcelTestSuiteSheetName, “GenerateSmartPractice”) &&
readFile(ExcelFilePath, ExcelTestCase, ExcelTestCaseSheetName, “smartPractice”)) {
logIn();
smartPractice();
if (readFile(ExcelFilePath, ExcelTestCase, ExcelTestCaseSheetName, “smartPracticeReportedQuestion”)) {
smartPracticeReportedQuestion();
}
} else {
logger.info(“Login not excecuted check excel file configuration”);
}
}
void smartPractice() throws Exception {
logger.info("Smart Practice Start");
Thread.sleep(mili5000);
String name = findByXpath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/androidx.viewpager.widget.ViewPager/android.view.ViewGroup/android.view.ViewGroup/android.widget.LinearLayout[1]/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.LinearLayout[1]/android.widget.TextView[1]").getText();
logger.info("name is :- "+name);
findById("com.abcd.test:id/linRewardCount").click();