hello, how to judge the appearance of toast ??
the script is : click the button and appear toast,i want to verify the toast . i can see the toast appear, but the method “Verify Element Exist” don’t think so. Report errors:
What is the locator you’ve used? The locator for the toast message (when it is displayed) is:
//android.widget.Toast[1]
but use this locator will get another report errors:
thank you, but it’s not going to work too. It’s the same report errors.
Thank you, but it’s not going to work too. It’s the same report errors.
who knows how to solve this problem,thanks
nobody, unless you provide more input : html code, snapshot of devtools with the target element highlited and so on. xpath locators are not very reliable sometime
Hello,here’s some information,please help me to have a look
Object:
script:
WebUI.waitForElementPresent(findTestObject(‘article comment/repeat comment’), 0)
Who knows how to solve this problem, thank you
Hi @25093419,
Please refer to this post: How to read toast message in android
Perfect, thank you very much !!!
but it also error :
println("Toast element: " + toast)
Toast element: [[com.kms.katalon.core.appium.driver.SwipeableAndroidDriver, Capabilities: {app=D:\Katalon Studio\autoapp2\app-release_5132_jiagu_sign_qihoo.apk, appPackage=cn.com.pcauto.android.browser, autoGrantPermissions=true, automationName=uiautomator2, databaseEnabled=false, desired={platformName=android, platform=ANDROID, app=D:\Katalon Studio\autoapp2\app-release_5132_jiagu_sign_qihoo.apk, autoGrantPermissions=true, automationName=uiautomator2, deviceName=meizu 16s (Android 9), fullReset=false, newCommandTimeout=1800, noReset=true, platformVersion=9, systemPort=7151, udid=971QAEUL6MP2T}, deviceApiLevel=28, deviceManufacturer=meizu, deviceModel=16s, deviceName=971QAEUL6MP2T, deviceScreenDensity=480, deviceScreenSize=1080x2232, deviceUDID=971QAEUL6MP2T, fullReset=false, javascriptEnabled=true, locationContextEnabled=false, networkConnectionEnabled=true, newCommandTimeout=1800, noReset=true, pixelRatio=3, platform=ANDROID, platformName=Android, platformVersion=9, statBarHeight=90, systemPort=7151, takesScreenshot=true, udid=971QAEUL6MP2T, viewportRect={left=0, top=90, width=1080, height=2046}, warnings={}, webStorageEnabled=false}] → xpath: //android.widget.Toast[@text=‘亲,您不能发重复的评论哦’]]
hello,long time no see.
Reason:
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
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘PC-PC’, ip: ‘192.168.20.121’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_181’
Driver info: com.kms.katalon.core.appium.driver.SwipeableAndroidDriver
Capabilities {app: D:\Katalon Studio\autoapp\a…, appPackage: cn.com.pcauto.android.browser, autoGrantPermissions: true, automationName: uiautomator2, databaseEnabled: false, desired: {app: D:\Katalon Studio\autoapp\a…, autoGrantPermissions: true, automationName: uiautomator2, deviceName: meizu 16s (Android 9), fullReset: false, newCommandTimeout: 1800, noReset: true, platform: ANDROID, platformName: android, platformVersion: 9, systemPort: 20017, udid: 971QAEUL6MP2T}, deviceApiLevel: 28, deviceManufacturer: meizu, deviceModel: 16s, deviceName: 971QAEUL6MP2T, deviceScreenDensity: 480, deviceScreenSize: 1080x2232, deviceUDID: 971QAEUL6MP2T, fullReset: false, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, newCommandTimeout: 1800, noReset: true, pixelRatio: 3, platform: ANDROID, platformName: Android, platformVersion: 9, statBarHeight: 90, systemPort: 20017, takesScreenshot: true, udid: 971QAEUL6MP2T, viewportRect: {height: 2046, left: 0, top: 90, width: 1080}, warnings: {}, webStorageEnabled: false}
Session ID: 73abb2bd-2a90-4def-b899-ac9534b13955
*** Element info: {Using=xpath, value=//android.widget.Toast[@text=‘亲,您不能发重复的评论哦’]}
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.execute(SwipeableAndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.findElement(SwipeableAndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428)
at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:152)
at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.findElementByXPath(SwipeableAndroidDriver.java:1)
at io.appium.java_client.MobileDriver$findElementByXPath.call(Unknown Source)
at article comment.run(article comment:62)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1577938373402.run(TempTestCase1577938373402.groovy:23)
Reason:
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
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘PC-PC’, ip: ‘192.168.20.121’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_181’
Driver info: com.kms.katalon.core.appium.driver.SwipeableAndroidDriver
Capabilities {app: D:\Katalon Studio\autoapp\a…, appPackage: cn.com.pcauto.android.browser, autoGrantPermissions: true, automationName: uiautomator2, databaseEnabled: false, desired: {app: D:\Katalon Studio\autoapp\a…, autoGrantPermissions: true, automationName: uiautomator2, deviceName: meizu 16s (Android 9), fullReset: false, newCommandTimeout: 1800, noReset: true, platform: ANDROID, platformName: android, platformVersion: 9, systemPort: 20017, udid: 971QAEUL6MP2T}, deviceApiLevel: 28, deviceManufacturer: meizu, deviceModel: 16s, deviceName: 971QAEUL6MP2T, deviceScreenDensity: 480, deviceScreenSize: 1080x2232, deviceUDID: 971QAEUL6MP2T, fullReset: false, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, newCommandTimeout: 1800, noReset: true, pixelRatio: 3, platform: ANDROID, platformName: Android, platformVersion: 9, statBarHeight: 90, systemPort: 20017, takesScreenshot: true, udid: 971QAEUL6MP2T, viewportRect: {height: 2046, left: 0, top: 90, width: 1080}, warnings: {}, webStorageEnabled: false}
Session ID: 73abb2bd-2a90-4def-b899-ac9534b13955
*** Element info: {Using=xpath, value=//android.widget.Toast[@text=‘亲,您不能发重复的评论哦’]}
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.execute(SwipeableAndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.findElement(SwipeableAndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:428)
at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:152)
at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.findElementByXPath(SwipeableAndroidDriver.java:1)
at io.appium.java_client.MobileDriver$findElementByXPath.call(Unknown Source)
at article comment.run(article comment:62)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1577938373402.run(TempTestCase1577938373402.groovy:23)