User Tools

Site Tools


informatica:linux:selenium

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
informatica:linux:selenium [2019/10/17 11:13] joseinformatica:linux:selenium [2019/10/17 11:41] jose
Line 344: Line 344:
           </div>           </div>
         </div>         </div>
-        <div tabindex="-1" class="masterMenuItem promptMenuOption" title="AUTONOMO CUENTA PROPIA">+        <div tabindex="-1" class="masterMenuItem promptMenuOption" title="AUTONOMO CUENTA">
           <div class="promptDropdownNoBorderDiv">           <div class="promptDropdownNoBorderDiv">
-            <input name="saw_263580_c_1" class="checkboxRadioButton" value="AUTONOMO CUENTA PROPIA" id="saw_263580_c_1_ck3" aria-labelledby="saw_263580_c_1_ck3_cblabel" tabindex="-1" style="" type="checkbox"> +            <input name="saw_263580_c_1" class="checkboxRadioButton" value="AUTONOMO CUENTA" id="saw_263580_c_1_ck3" aria-labelledby="saw_263580_c_1_ck3_cblabel" tabindex="-1" style="" type="checkbox"> 
-            <label class="checkboxRadioButtonLabel" for="saw_263580_c_1_ck3" id="saw_263580_c_1_ck3_cblabel">AUTONOMO CUENTA PROPIA</label>+            <label class="checkboxRadioButtonLabel" for="saw_263580_c_1_ck3" id="saw_263580_c_1_ck3_cblabel">AUTONOMO CUENTA</label>
           </div>           </div>
         </div>         </div>
Line 353: Line 353:
    </div>    </div>
 </div> </div>
 +</code>
 +{{:informatica:linux:padres_hijos.png|}}
 +
 +Queremos seleccionar input pero dentro del div que tiene lel texto en title.
 +{{:informatica:linux:padres_hijos2.png|}}
 +
 +Primero seleccionamos el bloque padre, buscando por div y title que queramos:
 +<code>
 +menu_click='NULL'
 +menu_click='AMA DE CASA'
 +menu_click='CUENTA AJENA FIJO'
 +
 +xpath='//div[@title="' + menu_click + '"]'
 +padre = driver.find_element_by_xpath(xpath)
 +</code>
 +Ahora dentro de esa caja, selecctionamos el input para hacer click
 +<code>
 +xpath2='.//input[@type="checkbox"]'
 +hijo = padre.find_element_by_xpath(xpath2)
 +hijo.click()
 </code> </code>
  
informatica/linux/selenium.txt · Last modified: 2022/12/27 09:08 by jose