0
Hello, I am trying to click on an element using webdriver with pythone Selenium
The element :
<a class="ppm_button_menu_item" alt="Exportar para CSV" href="javascript:clarity.uitk.exportToFile( 'npt.gridCsvExport&RhXm0r7tSeUqEr=true&odf_view=projectCreate.subObjList.cop_prj_statusrpt&odf_code=project&parentObjectCode=project&id=5180135&odf_concrete_parent_object_code=project&object=cop_prj_statusrpt&view_code=cop_prj_statusrptList&componentId=odf&portlet_id=projmgr.projectProperties&portlet_instance_id=cop_prj_statusrptList&portlet_instance_type=SYSTEM&page_id=projmgr.projectProperties', '25000', 'cop_prj_statusrptList')" onclick="event.cancelBubble=true;"> button1 </a>
The x.path of the element:
//*[@id="d560c4a2-e016-41f9-b56b-697b8fb4f5e6"]/div[1]/div[1]/span[3]/span[2]/a[3]
The problem is; This id number is auto generated and everytime the page is reload its change, so I cant use in the code.
The element that the ID of the previous code refers to is the following:
<form name="page" method="POST" id="d560c4a2-e016-41f9-b56b-697b8fb4f5e6" autocomplete="off" type="form" action="nu" onsubmit="return false;"><input type="hidden" name="scenarioId" value=""><div class="ppm_filter_section" aria-expanded="false">
I tried to make python find the button like this:
campo = driver.find_element_by_xpath(
'//*[@name="page"]/div[1]/div[1]/span[3]/span[2]/a[3]')
campo.click()
I don’t know what else to do :(
there are other tags
form
or just this one?– MagicHat