Wählen Sie mit Python dynamisches Element ausPython

Python-Programme
Anonymous
 Wählen Sie mit Python dynamisches Element aus

Post by Anonymous »

Ich versuche auf ein Element zu klicken, das in einer dynamischen Tabelle vorhanden ist (die seine Größe für jede Seite ändert). (Entschuldigung, wenn dies eine sehr grundlegende Frage ist, bin ich neu mit Selenium) < /p>

Code: Select all

frmMeterItem















[img]img/fond_bouton2_fil.jpg[/img]
Characteristics
[img]img/fond_bouton2_fil.jpg[/img]
Load profile
[img]img/fond_bouton2_fil.jpg[/img]
Logbook
[img]img/fond_bouton2_fil.jpg[/img]
End of billing
[img]img/fond_bouton2_fil.jpg[/img]
Instant.  data
[img]img/fond_bouton2_fil.jpg[/img]
Diagnostic
[img]img/fond_bouton2_fil.jpg[/img]
Power Quality
[img]img/fond_bouton2_fil.jpg[/img]
Tampering
[img]img/fond_bouton2_fil.jpg[/img]
Waveform



parent.frameMain.location.href='frmMeterItem.aspx?FirstAccess=&FormMode=0'



function resizePage()
{
try
{
var iHeight;
var oElement = document.getElementById('_ctl0');
if (oElement && (oElement.className == 'divMainPage'))
iHeight = -14;
else if (oElement && (oElement.className == 'divMainPage2 divMainPage'))
iHeight = -39;
else if (oElement && (oElement.className == 'divMainPage3 divMainPage'))
iHeight = -39;
else
{

oElement = document.getElementById('_ctlDiv');
if (oElement != null)
{
if (oElement.className == 'divMainPage2 divMainPage')
iHeight = m_bGecko ? -29 : -39;  // Spécifique page widget
else
iHeight = m_bGecko ? -2 : -12;  // Spécifique page widget
}
else
{
if (oElement == null)
oElement = document.getElementById('ctlDivMain');
if (oElement == null)
oElement = document.getElementById('_ctl1');
if (oElement && (oElement.className == 'divMainPage'))
iHeight = -14;
else if (oElement && (oElement.className == 'divMainPage2 divMainPage'))
iHeight = -39;
else if (oElement && (oElement.className == 'divMainPage3 divMainPage'))
iHeight = -39;
}
}

if (oElement)
{
if (m_bIE && (getInternetExplorerVersion() >= 10))
iHeight -= 17;
iHeight = iHeight + frameElement.offsetHeight;
if ((navigator.userAgent.indexOf('MSIE') != -1) && (parseInt(navigator.userAgent.split('MSIE')[1]) >= 10))  // If IE10
iHeight = iHeight - 17;
if (m_bGecko)
iHeight = (iHeight - 14) + 'px';
oElement.style.height = iHeight;
}
}
catch (x) { }
}
if (window.name == 'frameMain')
{
if (window.onload) {
var oldOnload = window.onload;
window.onload = function() { resizePage(); oldOnload(); }
} else window.onload = resizePage;

if (window.onresize) {
var oldResize = window.onresize;
window.onresize = function() { resizePage(); oldResize();  }
} else window.onresize = resizePage;
}




Dies ist das Menü:

Ich habe verschiedene Ansätze ausprobiert, die für dynamische Webelemente, aber ohne Erfolg, ohne Erfolge probiert. Ich stecke fest und würde es zutiefst schätzen, wenn mir jemand helfen könnte! selector = "#_ctl1 > tbody > tr > td:nth-child(4)"
element = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.CSS_SELECTOR, selector))
)
element.click()
< /code>
< /li>
< /ol>
Fehlermeldung: < /p>
Stacktrace:
GetHandleVerifier [0x003D0B43+25139]
(No symbol) [0x003613F4]
(No symbol) [0x002404E3]
(No symbol) [0x002883D7]
(No symbol) [0x0028872B]
(No symbol) [0x002D1002]
(No symbol) [0x002AD014]
(No symbol) [0x002CE778]
(No symbol) [0x002ACDC6]
(No symbol) [0x0027BDE9]
(No symbol) [0x0027D124]
GetHandleVerifier [0x006D4373+3185251]
GetHandleVerifier [0x006F291A+3309578]
GetHandleVerifier [0x006ECF42+3286578]
GetHandleVerifier [0x00467AE0+643536]
(No symbol) [0x0036A20D]
(No symbol) [0x003670B8]
(No symbol) [0x00367257]
(No symbol) [0x00359E00]
BaseThreadInitThunk [0x759D5D49+25]
RtlInitializeExceptionChain [0x77BCCDEB+107]
RtlGetAppContainerNamedObjectPath [0x77BCCD71+561]
< /code>

Über den vollständigen XPath:
< /p>
wait = WebDriverWait(driver, 10)

element = wait.until(EC.presence_of_element_located((By.XPATH,"/html/body/form/div/table/tbody/tr/td[4]")))
element.click()
< /code>
< /li>
< /ol>
Fehlermeldung: Gleich wie in 1 < /p>

Über den Text, den es enthält: < /p>
element = wait.until(EC.element_to_be_clickable((By.XPATH, "//span[contains(text(),'Load profile')]")))
element.click()
< /code>
< /li>
< /ol>
Fehlermeldung: < /p>
no such element: Unable to locate element: {"method":"xpath","selector":"//td[contains(text(),'Load profile')]"}
(Session info: chrome=133.0.6943.128); For documentation on this error, please visit: https://www.selenium.dev/documentation/ ... -exception
Stacktrace:
GetHandleVerifier [0x003D0B43+25139]
(No symbol) [0x003613F4]
(No symbol) [0x002404E3]
(No symbol) [0x002883D7]
(No symbol) [0x0028872B]
(No symbol) [0x002D1002]
(No symbol) [0x002AD014]
(No symbol) [0x002CE778]
(No symbol) [0x002ACDC6]
(No symbol) [0x0027BDE9]
(No symbol) [0x0027D124]
GetHandleVerifier [0x006D4373+3185251]
GetHandleVerifier [0x006F291A+3309578]
GetHandleVerifier [0x006ECF42+3286578]
GetHandleVerifier [0x00467AE0+643536]
(No symbol) [0x0036A20D]
(No symbol) [0x003670B8]
(No symbol) [0x00367257]
(No symbol) [0x00359E00]
BaseThreadInitThunk [0x759D5D49+25]
RtlInitializeExceptionChain [0x77BCCDEB+107]
RtlGetAppContainerNamedObjectPath [0x77BCCD71+561]
< /code>
Ich habe auch versucht, zum Bild "FrameInfo" zu wechseln, bevor ich ihn per Text findet, aber die gleiche Fehlermeldung wie in 1.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).
< /code>
Bearbeiten: Ich habe die Quelle HTML und weitere Möglichkeiten hinzugefügt, die ich ausprobiert habe. Ich kann die HTML nicht teilen, da dies eine lokale Seite ist.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post