0
I am learning about Web Scraping, I have already managed to do some actions but I came across problem in a dynamic page where values are changed every refresh.
Unfortunately I can not pass the access url because it is only internal, but it follows the html code of the page, the id and name values change constantly, so I thought to take the dv, but I was not successful. I’d like to give a "tick" on that radiobutton
<div class="clsCheckBoxRow"><
div class="dijitInline dijitRadio dijitRadioChecked">
<input name="pOpt_N4eaf5820x6195143c_NS_" id="N4eaf5820x61951468_NS_" type="radio" role="radio" value="1" dv="Pesquisa por data de abertura (Criado em)" class="dijitCheckBoxInput" onclick="return PRMTUtils.F_OnChange(event, this);" onkeypress="return PRMTUtils.F_OnChange(event, this);" onfocus="return PRMTUtils.f_CheckboxOnFocus(this);" onblur="return PRMTUtils.f_CheckboxOnBlur(this);" aria-checked="false">
</div>
<label for="N4eaf5820x61951468_NS_" style="border: 0px none;">Pesquisa por data de abertura (Criado em)</label>
Follow the code I’m using so far:
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
import base64
senha = b'criptografada'
browser = webdriver.Chrome('D:\\user\chromedriver.exe')
browser.get('url-interna')
browser.maximize_window()
time.sleep(2)
botao1 = browser.find_element_by_id('cmdOK').click()
time.sleep(2)
step1 = browser.find_element_by_name('CAMUsername').send_keys('teste')
time.sleep(2)
step2 = browser.find_element_by_name('CAMPassword').send_keys(base64.b64decode(senha).decode("utf-8", "ignore"))
time.sleep(2)
botao2 = browser.find_element_by_id('cmdOK').click()
time.sleep(10)
# -*- código a ser implementado para extrais as informações do radiobutton*-
step3 = browser.find_elements(By.ID,'PRMT_SV*')[1]
print (step3)
time.sleep(5)
browser.close()
browser.quit()
Name and id follow some pattern?
– TiagoA
They follow this pattern withNS_ at the end, but for example they can change all the rest of the string, e.g.: "N4eaf5820x61951468_ns_" "N5agh6870x61951468_ns_" "F6crhf8650x64551454_ns_" E so on and on.
– Leandro de Matos