-1

enter image description here

I am unable to access this menu in selenium the web element doesn't appear in inspector until manually done

<a id="cke_3275" class="cke_menubutton cke_menubutton__table cke_menubutton_off cke_menubutton__table" href="javascript:void('Table Properties')" title="Table Properties" tabindex="-1" _cke_focus="1" hidefocus="true" role="menuitem" aria-haspopup="false" aria-disabled="false" onmouseover="CKEDITOR.tools.callFunction(666,5);" onmouseout="CKEDITOR.tools.callFunction(667,5);" onclick="CKEDITOR.tools.callFunction(668,5); return false;">
  <span class="cke_menubutton_inner">
    <span class="cke_menubutton_icon">
      <span class="cke_button_icon cke_button__table_icon" style="background-image:url(https://lms.testbook.com/vendor/ckeditor/plugins/icons.png?t=E6FD);background-position:0 -1896px;background-size:auto;">
      </span>
    </span>
  <span class="cke_menubutton_label">
    Table Properties
  </span>
  </span>
</a>

I tried accessing parent, click and actions.perform() nothing seems to work.

When i hover over the menu contents i see javascript:void('contentname'), i pasted this in the inspector and found the web element.

Epsi95
  • 8,832
  • 1
  • 16
  • 34

1 Answers1

0
iframe=WebDriverWait(driver,  10).until(EC.presence_of_element_located((By.XPATH, "/html/body/iframe")))

driver.switch_to.frame(iframe)
driver.find_element_by_tagname("a")

switch to iframe and then add rest of the code

driver.switch_to.default_content()  

you need to switch to default content after you are done with the element and want to interact with an element outside the iframe

PDHide
  • 18,113
  • 2
  • 31
  • 46
  • 1
    Worked like a charm, much appreciation! –  Jan 02 '21 at 14:11
  • https://stackoverflow.com/questions/65540342/how-to-locate-web-elements-with-similar-attributes can u help? –  Jan 02 '21 at 14:45