Selenium Chrome Driver: Javascript on click function. element not visible or nothing happens





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















So I'm working on a script at work that automates VMWare's Airwatch token generation for MDM. It was functioning, but they updated the server/Airwatch Console and this javascript onclick function broke it. I've already searched through various forums and posts and have no luck getting it to work.
If I have selenium find the element and .click() on it, I get the not visible/not interactable error.
Currently, I have:



addButton=driver.find_element_by_css_selector("a.add.profile.small")
webdriver.ActionChains(driver).move_to_element(addButton).perform().click(addButton)


And no errors occur but it doesn't do anything.



When manually moving the mouse over the button it changes to a hand instead of the pointer and the button background color changes.



Here's a snippet of the element properties:



        <a class="add profile small" onclick="F5_r2u();F5_Event_common(event);
try{return(eval(F5_Invoke_eval_event(null,F5_jsBody(function(){addTagRow(this);
}))))}finally{try{F5_Event_finally(event)}catch(e){}}">Add</a>

selector: #31 34364e7_Tag_Plural > a
xpath: //*[@id="134364e7_Tag_Plural"]/a


Any Advice?



Pretty sure I need to have Selenium hover over the button, then click on it, or execute the javascript. Not sure how to do that though.



Screenshot of Add Button










share|improve this question































    0















    So I'm working on a script at work that automates VMWare's Airwatch token generation for MDM. It was functioning, but they updated the server/Airwatch Console and this javascript onclick function broke it. I've already searched through various forums and posts and have no luck getting it to work.
    If I have selenium find the element and .click() on it, I get the not visible/not interactable error.
    Currently, I have:



    addButton=driver.find_element_by_css_selector("a.add.profile.small")
    webdriver.ActionChains(driver).move_to_element(addButton).perform().click(addButton)


    And no errors occur but it doesn't do anything.



    When manually moving the mouse over the button it changes to a hand instead of the pointer and the button background color changes.



    Here's a snippet of the element properties:



            <a class="add profile small" onclick="F5_r2u();F5_Event_common(event);
    try{return(eval(F5_Invoke_eval_event(null,F5_jsBody(function(){addTagRow(this);
    }))))}finally{try{F5_Event_finally(event)}catch(e){}}">Add</a>

    selector: #31 34364e7_Tag_Plural > a
    xpath: //*[@id="134364e7_Tag_Plural"]/a


    Any Advice?



    Pretty sure I need to have Selenium hover over the button, then click on it, or execute the javascript. Not sure how to do that though.



    Screenshot of Add Button










    share|improve this question



























      0












      0








      0








      So I'm working on a script at work that automates VMWare's Airwatch token generation for MDM. It was functioning, but they updated the server/Airwatch Console and this javascript onclick function broke it. I've already searched through various forums and posts and have no luck getting it to work.
      If I have selenium find the element and .click() on it, I get the not visible/not interactable error.
      Currently, I have:



      addButton=driver.find_element_by_css_selector("a.add.profile.small")
      webdriver.ActionChains(driver).move_to_element(addButton).perform().click(addButton)


      And no errors occur but it doesn't do anything.



      When manually moving the mouse over the button it changes to a hand instead of the pointer and the button background color changes.



      Here's a snippet of the element properties:



              <a class="add profile small" onclick="F5_r2u();F5_Event_common(event);
      try{return(eval(F5_Invoke_eval_event(null,F5_jsBody(function(){addTagRow(this);
      }))))}finally{try{F5_Event_finally(event)}catch(e){}}">Add</a>

      selector: #31 34364e7_Tag_Plural > a
      xpath: //*[@id="134364e7_Tag_Plural"]/a


      Any Advice?



      Pretty sure I need to have Selenium hover over the button, then click on it, or execute the javascript. Not sure how to do that though.



      Screenshot of Add Button










      share|improve this question
















      So I'm working on a script at work that automates VMWare's Airwatch token generation for MDM. It was functioning, but they updated the server/Airwatch Console and this javascript onclick function broke it. I've already searched through various forums and posts and have no luck getting it to work.
      If I have selenium find the element and .click() on it, I get the not visible/not interactable error.
      Currently, I have:



      addButton=driver.find_element_by_css_selector("a.add.profile.small")
      webdriver.ActionChains(driver).move_to_element(addButton).perform().click(addButton)


      And no errors occur but it doesn't do anything.



      When manually moving the mouse over the button it changes to a hand instead of the pointer and the button background color changes.



      Here's a snippet of the element properties:



              <a class="add profile small" onclick="F5_r2u();F5_Event_common(event);
      try{return(eval(F5_Invoke_eval_event(null,F5_jsBody(function(){addTagRow(this);
      }))))}finally{try{F5_Event_finally(event)}catch(e){}}">Add</a>

      selector: #31 34364e7_Tag_Plural > a
      xpath: //*[@id="134364e7_Tag_Plural"]/a


      Any Advice?



      Pretty sure I need to have Selenium hover over the button, then click on it, or execute the javascript. Not sure how to do that though.



      Screenshot of Add Button







      javascript python selenium selenium-chromedriver airwatch






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 19 '18 at 21:40







      Patrick Dugan

















      asked Nov 16 '18 at 21:57









      Patrick DuganPatrick Dugan

      116




      116
























          1 Answer
          1






          active

          oldest

          votes


















          0














          when you switch from tab User to Tags it need to wait until ADD button visible



          # click tab Tags
          tabTags = driver.find_element_by_css_selector('tab.tags.selector').click()
          # wait until visible
          addButton = WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'a.add.profile.small')))
          addButton.click()


          using ActionChains maybe like this



          tabTags = driver.find_element_by_css_selector('tab.tags.selector')
          addButton = driver.find_element_by_css_selector("a.add.profile.small")

          actions = webdriver.ActionChains(driver)
          actions.click(tabTags)
          actions.click(addButton)
          actions.perform()





          share|improve this answer


























          • Should've stated this in the initial post, but I have an implicitlyWait set to 10 for the whole script

            – Patrick Dugan
            Nov 18 '18 at 3:04











          • implicitlyWait and WebDriverWait is different. you need to add demo page or url in the initial post because I think its dynamic page

            – ewwink
            Nov 18 '18 at 3:11













          • Ah okay. Didn't know that. I'll try that on Monday then. Thanks!

            – Patrick Dugan
            Nov 18 '18 at 4:13











          • The site isn't public, so I can't share the URL. It is a dynamic page.

            – Patrick Dugan
            Nov 18 '18 at 4:15











          • Still no luck. It gets a timeout error with the webDriverWait set to 20, and an element not interactable anytime I have it click on it without the webdriverwait

            – Patrick Dugan
            Nov 19 '18 at 21:39












          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',
          autoActivateHeartbeat: false,
          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%2f53345983%2fselenium-chrome-driver-javascript-on-click-function-element-not-visible-or-not%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









          0














          when you switch from tab User to Tags it need to wait until ADD button visible



          # click tab Tags
          tabTags = driver.find_element_by_css_selector('tab.tags.selector').click()
          # wait until visible
          addButton = WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'a.add.profile.small')))
          addButton.click()


          using ActionChains maybe like this



          tabTags = driver.find_element_by_css_selector('tab.tags.selector')
          addButton = driver.find_element_by_css_selector("a.add.profile.small")

          actions = webdriver.ActionChains(driver)
          actions.click(tabTags)
          actions.click(addButton)
          actions.perform()





          share|improve this answer


























          • Should've stated this in the initial post, but I have an implicitlyWait set to 10 for the whole script

            – Patrick Dugan
            Nov 18 '18 at 3:04











          • implicitlyWait and WebDriverWait is different. you need to add demo page or url in the initial post because I think its dynamic page

            – ewwink
            Nov 18 '18 at 3:11













          • Ah okay. Didn't know that. I'll try that on Monday then. Thanks!

            – Patrick Dugan
            Nov 18 '18 at 4:13











          • The site isn't public, so I can't share the URL. It is a dynamic page.

            – Patrick Dugan
            Nov 18 '18 at 4:15











          • Still no luck. It gets a timeout error with the webDriverWait set to 20, and an element not interactable anytime I have it click on it without the webdriverwait

            – Patrick Dugan
            Nov 19 '18 at 21:39
















          0














          when you switch from tab User to Tags it need to wait until ADD button visible



          # click tab Tags
          tabTags = driver.find_element_by_css_selector('tab.tags.selector').click()
          # wait until visible
          addButton = WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'a.add.profile.small')))
          addButton.click()


          using ActionChains maybe like this



          tabTags = driver.find_element_by_css_selector('tab.tags.selector')
          addButton = driver.find_element_by_css_selector("a.add.profile.small")

          actions = webdriver.ActionChains(driver)
          actions.click(tabTags)
          actions.click(addButton)
          actions.perform()





          share|improve this answer


























          • Should've stated this in the initial post, but I have an implicitlyWait set to 10 for the whole script

            – Patrick Dugan
            Nov 18 '18 at 3:04











          • implicitlyWait and WebDriverWait is different. you need to add demo page or url in the initial post because I think its dynamic page

            – ewwink
            Nov 18 '18 at 3:11













          • Ah okay. Didn't know that. I'll try that on Monday then. Thanks!

            – Patrick Dugan
            Nov 18 '18 at 4:13











          • The site isn't public, so I can't share the URL. It is a dynamic page.

            – Patrick Dugan
            Nov 18 '18 at 4:15











          • Still no luck. It gets a timeout error with the webDriverWait set to 20, and an element not interactable anytime I have it click on it without the webdriverwait

            – Patrick Dugan
            Nov 19 '18 at 21:39














          0












          0








          0







          when you switch from tab User to Tags it need to wait until ADD button visible



          # click tab Tags
          tabTags = driver.find_element_by_css_selector('tab.tags.selector').click()
          # wait until visible
          addButton = WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'a.add.profile.small')))
          addButton.click()


          using ActionChains maybe like this



          tabTags = driver.find_element_by_css_selector('tab.tags.selector')
          addButton = driver.find_element_by_css_selector("a.add.profile.small")

          actions = webdriver.ActionChains(driver)
          actions.click(tabTags)
          actions.click(addButton)
          actions.perform()





          share|improve this answer















          when you switch from tab User to Tags it need to wait until ADD button visible



          # click tab Tags
          tabTags = driver.find_element_by_css_selector('tab.tags.selector').click()
          # wait until visible
          addButton = WebDriverWait(driver, 5).until(EC.presence_of_element_located((By.CSS_SELECTOR, 'a.add.profile.small')))
          addButton.click()


          using ActionChains maybe like this



          tabTags = driver.find_element_by_css_selector('tab.tags.selector')
          addButton = driver.find_element_by_css_selector("a.add.profile.small")

          actions = webdriver.ActionChains(driver)
          actions.click(tabTags)
          actions.click(addButton)
          actions.perform()






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 17 '18 at 3:11

























          answered Nov 17 '18 at 2:03









          ewwinkewwink

          12.3k22441




          12.3k22441













          • Should've stated this in the initial post, but I have an implicitlyWait set to 10 for the whole script

            – Patrick Dugan
            Nov 18 '18 at 3:04











          • implicitlyWait and WebDriverWait is different. you need to add demo page or url in the initial post because I think its dynamic page

            – ewwink
            Nov 18 '18 at 3:11













          • Ah okay. Didn't know that. I'll try that on Monday then. Thanks!

            – Patrick Dugan
            Nov 18 '18 at 4:13











          • The site isn't public, so I can't share the URL. It is a dynamic page.

            – Patrick Dugan
            Nov 18 '18 at 4:15











          • Still no luck. It gets a timeout error with the webDriverWait set to 20, and an element not interactable anytime I have it click on it without the webdriverwait

            – Patrick Dugan
            Nov 19 '18 at 21:39



















          • Should've stated this in the initial post, but I have an implicitlyWait set to 10 for the whole script

            – Patrick Dugan
            Nov 18 '18 at 3:04











          • implicitlyWait and WebDriverWait is different. you need to add demo page or url in the initial post because I think its dynamic page

            – ewwink
            Nov 18 '18 at 3:11













          • Ah okay. Didn't know that. I'll try that on Monday then. Thanks!

            – Patrick Dugan
            Nov 18 '18 at 4:13











          • The site isn't public, so I can't share the URL. It is a dynamic page.

            – Patrick Dugan
            Nov 18 '18 at 4:15











          • Still no luck. It gets a timeout error with the webDriverWait set to 20, and an element not interactable anytime I have it click on it without the webdriverwait

            – Patrick Dugan
            Nov 19 '18 at 21:39

















          Should've stated this in the initial post, but I have an implicitlyWait set to 10 for the whole script

          – Patrick Dugan
          Nov 18 '18 at 3:04





          Should've stated this in the initial post, but I have an implicitlyWait set to 10 for the whole script

          – Patrick Dugan
          Nov 18 '18 at 3:04













          implicitlyWait and WebDriverWait is different. you need to add demo page or url in the initial post because I think its dynamic page

          – ewwink
          Nov 18 '18 at 3:11







          implicitlyWait and WebDriverWait is different. you need to add demo page or url in the initial post because I think its dynamic page

          – ewwink
          Nov 18 '18 at 3:11















          Ah okay. Didn't know that. I'll try that on Monday then. Thanks!

          – Patrick Dugan
          Nov 18 '18 at 4:13





          Ah okay. Didn't know that. I'll try that on Monday then. Thanks!

          – Patrick Dugan
          Nov 18 '18 at 4:13













          The site isn't public, so I can't share the URL. It is a dynamic page.

          – Patrick Dugan
          Nov 18 '18 at 4:15





          The site isn't public, so I can't share the URL. It is a dynamic page.

          – Patrick Dugan
          Nov 18 '18 at 4:15













          Still no luck. It gets a timeout error with the webDriverWait set to 20, and an element not interactable anytime I have it click on it without the webdriverwait

          – Patrick Dugan
          Nov 19 '18 at 21:39





          Still no luck. It gets a timeout error with the webDriverWait set to 20, and an element not interactable anytime I have it click on it without the webdriverwait

          – Patrick Dugan
          Nov 19 '18 at 21:39




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345983%2fselenium-chrome-driver-javascript-on-click-function-element-not-visible-or-not%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

          Xamarin.iOS Cant Deploy on Iphone

          Glorious Revolution

          Dulmage-Mendelsohn matrix decomposition in Python