mercredi 4 juillet 2018

Return true if element is found

I'm trying to check if an image is being displayed using if/else and branch out my actions from there but I can't seem to find a condition that works. All the things I've tried so far are either true in all situations or false all the time.

Here's the stuff that I've tried so far:

client.elements('android=new UiSelector().resourceId("com.orgname.App:id/imgQuickLogin")')
  .then(function Image(img) {
    var imageValues = img.value
    return imageValues
  })
  .elementIdDisplayed('android=new UiSelector().resourceId("com.orgname.App:id/imgQuickLogin")')

  .waitForExist('android=new UiSelector().resourceId("com.orgname.App:id/imgQuickLogin")', 8000)

client.isExisting('android=new UiSelector().resourceId("com.orgname.App:id/imgQuickLogin")') === true

var isVisible = client.elements('android=new UiSelector().resourceId("com.orgname.App:id/imgQuickLogin")')
if (isVisible.value.length != 0) {

  client.elements('android=new UiSelector().resourceId("com.orgname.App:id/imgQuickLogin")').then(function(img) {

        var isVisible = client.elements('android=new UiSelector().resourceId("com.orgname.App:id/imgQuickLogin")')
        if (JSON.stringify(isVisible) != '') {

Aucun commentaire:

Enregistrer un commentaire