InternetExplorer Com Oggetto, getElementById, getElementsByName e getElementsByTagName
-
13-10-2019 - |
Domanda
Voglio creare un WebTest con PowerShell. Al momento ho avuto un problema con uno SharePoint Casella di testo quando creo una nuova voce Calendario. Le proprietà del campo sono:
Ora si può vedere, non v'è alcun ID fisso che posso usare.
E 'possibile cercare la parola "Titel" e ottenere l'ID?
(title = Titel perché è tedesco ;-))
Il seguente codice non funziona.
$ie2.Document.getElementById( "*ctl00$TextField").value = "test"
$ie2.Document.getElementByName( "*ctl00$TextField").value = "test"
$ie2.Document.getElementByTagName( "Titel").value = "test"
Sourcecode in Internet Explorer:
<td nowrap="true" valign="top" width="190px" class="ms-formlabel"><h3 class="ms-standardheader">
<nobr>Titel<span class="ms-formvalidation" title="Dies ist ein Pflichtfeld." > *</span></nobr>
</h3></td>
<td valign="top" class="ms-formbody">
<!-- FieldName="Titel"
FieldInternalName="Title"
FieldType="SPFieldText"
-->
<span dir="none">
<input name="ctl00$m$g_27855e01_08c1_498d_b130_0b761c472fbd$ctl00$ctl05$ctl00$ctl00$ctl00$ctl04$ctl00$ctl00$TextField" type="text" maxlength="255" id="ctl00_m_g_27855e01_08c1_498d_b130_0b761c472fbd_ctl00_ctl05_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField" title="Titel" class="ms-long ms-spellcheck-true" /><br />
</span>
Soluzione
Si dovrebbe considerare di usare WATIN da PowerShell , WATIN renderebbe la vita molto più facile.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow