I have this line of code that I want to click using Selenium WebDriver with Python, it is derived from an iframe:
<table width="100%" cellspacing="0" align="center" class="maintable">
<tr>
<td align="left" style="white-space: nowrap;">
<label for="file" class="pb default" style="display: inline-block;margin: 5px 10px;">Select File</label>
<input id="fileName" onmousedown="" type="text" value="" class="fld fld_ro text ib" readonly size="50"/>
<input id="file" type="file" name="value" title="Specify a New File" onchange="" size="35" class="text" style=" width: 0.1px;height: 0.1px !important;fileStyle: 0;overflow: hidden;position: absolute;z-index: -1;opacity: 0;" value="" onclick="if(!parent.undef(parent.firingControl) && parent.firingControl.id==this.id){parent.sendEvent('clientonly','clickFileButton', this.id)}">
</td>
</tr>
</table>
I want to click the "Select File" label (it is a button but without XPath or id) but I really am unable to do so...
this is the iframe :
<iframe id="upload_iframe" allowtransparency="true" class=" " role="presentation" tabindex="0" src="http://www.test.com/webclient/utility/uploadfile.jsp?controlId=itemimage_3_1&componentId=itemimage_3_1-if&uisessionid=1689" scrolling="no" marginheight="0" marginwidth="0" onfocus="setCurrentfocusId(event,this);" style="border:0px;" width="400" height="33" frameborder="0"> </iframe>
I have used this line of script to click the label but the button does not respond to my code:
button_element = browser.find_element_by_class_name('pb default')
button_element.click()
Do you know how to click that element? I am using firefox to do that... Any answer is appreciated, thx.