iOS Appium 1.9 - Clicking on parent of element using iOS Class Chain











up vote
0
down vote

favorite












I have an image within a collection view that I am unable to click on. Appium can find the element fine but using the is_displayed() function always returns false. I read up on the iOS Class chain function so attempted to use that to click on the images parent XCUIElementTypeCell (Which can be clicked on, but has no label, or name value annoyingly)



My attempt:



self._driver.find_element(By.IOS_CLASS_CHAIN, "**/XCUIElementTypeImage[`name BEGINSWITH "Click Me"`]/**/XCUIElementTypeOther/**/XCUIElementTypeCell")


This gives a NoSuchElementException



The app structure looks like this:
Screenshot of a sample of the app structure



So that XCUIElementTypeImage in the centre is what I am trying to target using name which equals "click me" in this example. The parent XCUIElementTypeOther also can be found but is not clickable so the only solution for me is jump up two levels to the XCUIElementTypeCell



P.S Please no Xpath suggestions



P.S2 Thanks for the help










share|improve this question




























    up vote
    0
    down vote

    favorite












    I have an image within a collection view that I am unable to click on. Appium can find the element fine but using the is_displayed() function always returns false. I read up on the iOS Class chain function so attempted to use that to click on the images parent XCUIElementTypeCell (Which can be clicked on, but has no label, or name value annoyingly)



    My attempt:



    self._driver.find_element(By.IOS_CLASS_CHAIN, "**/XCUIElementTypeImage[`name BEGINSWITH "Click Me"`]/**/XCUIElementTypeOther/**/XCUIElementTypeCell")


    This gives a NoSuchElementException



    The app structure looks like this:
    Screenshot of a sample of the app structure



    So that XCUIElementTypeImage in the centre is what I am trying to target using name which equals "click me" in this example. The parent XCUIElementTypeOther also can be found but is not clickable so the only solution for me is jump up two levels to the XCUIElementTypeCell



    P.S Please no Xpath suggestions



    P.S2 Thanks for the help










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have an image within a collection view that I am unable to click on. Appium can find the element fine but using the is_displayed() function always returns false. I read up on the iOS Class chain function so attempted to use that to click on the images parent XCUIElementTypeCell (Which can be clicked on, but has no label, or name value annoyingly)



      My attempt:



      self._driver.find_element(By.IOS_CLASS_CHAIN, "**/XCUIElementTypeImage[`name BEGINSWITH "Click Me"`]/**/XCUIElementTypeOther/**/XCUIElementTypeCell")


      This gives a NoSuchElementException



      The app structure looks like this:
      Screenshot of a sample of the app structure



      So that XCUIElementTypeImage in the centre is what I am trying to target using name which equals "click me" in this example. The parent XCUIElementTypeOther also can be found but is not clickable so the only solution for me is jump up two levels to the XCUIElementTypeCell



      P.S Please no Xpath suggestions



      P.S2 Thanks for the help










      share|improve this question















      I have an image within a collection view that I am unable to click on. Appium can find the element fine but using the is_displayed() function always returns false. I read up on the iOS Class chain function so attempted to use that to click on the images parent XCUIElementTypeCell (Which can be clicked on, but has no label, or name value annoyingly)



      My attempt:



      self._driver.find_element(By.IOS_CLASS_CHAIN, "**/XCUIElementTypeImage[`name BEGINSWITH "Click Me"`]/**/XCUIElementTypeOther/**/XCUIElementTypeCell")


      This gives a NoSuchElementException



      The app structure looks like this:
      Screenshot of a sample of the app structure



      So that XCUIElementTypeImage in the centre is what I am trying to target using name which equals "click me" in this example. The parent XCUIElementTypeOther also can be found but is not clickable so the only solution for me is jump up two levels to the XCUIElementTypeCell



      P.S Please no Xpath suggestions



      P.S2 Thanks for the help







      appium appium-ios python-appium






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 at 14:47









      Wasiq Bhamla

      52539




      52539










      asked Nov 19 at 16:58









      King

      118112




      118112
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Try the following:



          "**/XCUIElementTypeCell[$type=XCUIElementTypeImage AND name BEGINSWITH 'Click Me'$]"


          OR



          "**/XCUIElementTypeCell[$type='XCUIElementTypeImage' AND name BEGINSWITH 'Click Me'$]"





          share|improve this answer





















          • Thanks I'll give it a go, what does the '$' sign refer to exactly?
            – King
            Nov 21 at 9:16










          • Doesn't work, seems that it's picking up the internal element. I've managed to get it working by using an xpath command and adding "parent::XCUIElementTypeOther" on the end, so it's not too long
            – King
            Nov 23 at 15:41











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53379385%2fios-appium-1-9-clicking-on-parent-of-element-using-ios-class-chain%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Try the following:



          "**/XCUIElementTypeCell[$type=XCUIElementTypeImage AND name BEGINSWITH 'Click Me'$]"


          OR



          "**/XCUIElementTypeCell[$type='XCUIElementTypeImage' AND name BEGINSWITH 'Click Me'$]"





          share|improve this answer





















          • Thanks I'll give it a go, what does the '$' sign refer to exactly?
            – King
            Nov 21 at 9:16










          • Doesn't work, seems that it's picking up the internal element. I've managed to get it working by using an xpath command and adding "parent::XCUIElementTypeOther" on the end, so it's not too long
            – King
            Nov 23 at 15:41















          up vote
          0
          down vote













          Try the following:



          "**/XCUIElementTypeCell[$type=XCUIElementTypeImage AND name BEGINSWITH 'Click Me'$]"


          OR



          "**/XCUIElementTypeCell[$type='XCUIElementTypeImage' AND name BEGINSWITH 'Click Me'$]"





          share|improve this answer





















          • Thanks I'll give it a go, what does the '$' sign refer to exactly?
            – King
            Nov 21 at 9:16










          • Doesn't work, seems that it's picking up the internal element. I've managed to get it working by using an xpath command and adding "parent::XCUIElementTypeOther" on the end, so it's not too long
            – King
            Nov 23 at 15:41













          up vote
          0
          down vote










          up vote
          0
          down vote









          Try the following:



          "**/XCUIElementTypeCell[$type=XCUIElementTypeImage AND name BEGINSWITH 'Click Me'$]"


          OR



          "**/XCUIElementTypeCell[$type='XCUIElementTypeImage' AND name BEGINSWITH 'Click Me'$]"





          share|improve this answer












          Try the following:



          "**/XCUIElementTypeCell[$type=XCUIElementTypeImage AND name BEGINSWITH 'Click Me'$]"


          OR



          "**/XCUIElementTypeCell[$type='XCUIElementTypeImage' AND name BEGINSWITH 'Click Me'$]"






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 at 4:56









          Alesia D

          1




          1












          • Thanks I'll give it a go, what does the '$' sign refer to exactly?
            – King
            Nov 21 at 9:16










          • Doesn't work, seems that it's picking up the internal element. I've managed to get it working by using an xpath command and adding "parent::XCUIElementTypeOther" on the end, so it's not too long
            – King
            Nov 23 at 15:41


















          • Thanks I'll give it a go, what does the '$' sign refer to exactly?
            – King
            Nov 21 at 9:16










          • Doesn't work, seems that it's picking up the internal element. I've managed to get it working by using an xpath command and adding "parent::XCUIElementTypeOther" on the end, so it's not too long
            – King
            Nov 23 at 15:41
















          Thanks I'll give it a go, what does the '$' sign refer to exactly?
          – King
          Nov 21 at 9:16




          Thanks I'll give it a go, what does the '$' sign refer to exactly?
          – King
          Nov 21 at 9:16












          Doesn't work, seems that it's picking up the internal element. I've managed to get it working by using an xpath command and adding "parent::XCUIElementTypeOther" on the end, so it's not too long
          – King
          Nov 23 at 15:41




          Doesn't work, seems that it's picking up the internal element. I've managed to get it working by using an xpath command and adding "parent::XCUIElementTypeOther" on the end, so it's not too long
          – King
          Nov 23 at 15:41


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53379385%2fios-appium-1-9-clicking-on-parent-of-element-using-ios-class-chain%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wiesbaden

          Marschland

          Dieringhausen