1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Select dynamic element using Python

Discussão em 'Python' iniciado por Stack, Fevereiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to click on an element present in a dynamic table (that changes its size for each page). (Sorry if this is a very basic question, I'm new using Selenium)

    <td class="menu2_sel" nowrap="nowrap" align="center" onmousedown="m_down_btn(this,'menu2');" onmouseover="m_over_btn(this,'menu2');" onmouseout="m_out_btn(this,'menu2');" onclick="location.href='frmMeterItemMenu.aspx?Tab=LoadProfile'">
    <span id="\_ctl5" class="labelLink" >Load profile</span>
    </td>


    I have tried different approaches that supposedly work for dynamic web elements but with no success. I'm stuck and would deeply appreciate if someone could help me!

    wait = WebDriverWait(driver, 10)


    1. Through the ID:

      element = wait.until(EC.element_to_be_clickable((By.ID, "_ctl5")))
      element.click()

    2. Through the full XPATH:

      element = wait.until(EC.presence_of_element_located((By.XPATH,"/html/body/form/div/table/tbody/tr/td[4]")))
      element.click()

    3. Through the text that it contains:

      element = wait.until(EC.element_to_be_clickable((By.XPATH, "//span[contains(text(),'Load profile')]")))
      element.click()

    For all, I get the error:

    Created TensorFlow Lite XNNPACK delegate for CPU.
    Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors (tensor#-1 is a dynamic-sized tensor).

    Continue reading...

Compartilhe esta Página