I'm trying to click on an element that is on a website. I don't know why my script doesn't see the element. I have it running and when I use Python Shell and write:
z = browser.find_element_by_css_selector("input[name='0_40']")
I get:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"input[name='0_40']"}
I know that element exists because when I go to Console and put:
$$("input[name='0_40']")
I get:
[input#C0_40.textfield]
0
:
input#C0_40.textfield
length
:
1
__proto__
:
Array(0)
This is the elements website location (element at the end):
<html>
<body class="tebody" onload="javascript:CARO.caroInit();" onresize="javascript:CARO.onResize();">
<div id=”normMenu”>
<div id=”caroHolder” style=”top: 81px;”>
<div id="e1AppFrameContainer" class="caroLeft caroExpanded" tilesize="small" whichcaption="label_two_rows">
<div id="outerRCUX">
<div id="innerRCUX">
<iframe id="e1menuAppIframe" name="e1menuAppIframe" title="e1menuAppIframe" frameborder="0" width="100%" height="100%" src="/jde/Welcome.mafService?e1.state=maximized&e1.service=Welcome&E1CurrentWindowName=E1MENUMAIN_8595835811943006208&RENDER_MAFLET=E1Menu&e1.namespace=&namespace=&e1.mode=view">
<html>
<body>
<form style="margin: 0px 0px 0px 0px;" action="javascript:void(0);" id="E1PaneForm" name="P43070_W43070A" method="post">
<div id="e1formDiv" tabindex="-1" onscroll="FormDivScrollHandler.syncToolBar(true)" class="formdiv_noIE e1container" style="height: 570px; width: 768px;">
<table width="100%" id="FormAboveGridTable" border="0" cellspacing="0" cellpadding="0" style="width:100%; padding: 3px 0px 0px 3px;"><tbody><tr><td>
<tbody>
<tr>
<td>
<div style="position: relative; width: 744px; height: 367px;" id="FormAboveGrid" onkeydown="return FormKeyboardHandler.onContainerKeyDown(event,'0')" onmousedown="return true;" oncontextmenu="return FormKeyboardHandler.formExitContextMenu(event)">
<span id="outer0_45" style="position: absolute; left: 3px; top: 3px; width: 722px;" hasadjacentcontrols="true" shouldelongate="true">
<table class="GroupBox" cellspacing="0" cellpadding="0" border="1"><tbody><tr><td height="182" valign="TOP" class="ClearBorders">
<tbody>
<tr>
<td height="182" valign="TOP" class="ClearBorders">
<div style="position: relative; width: 722px; height: 182px;" id="div0_45" onkeydown="return FormKeyboardHandler.onContainerKeyDown(event,'0_45')" onmousedown="return true;" oncontextmenu="return FormKeyboardHandler.formExitContextMenu(event)">
<span id="outer0_40" style="position:absolute; left: 151px; top: 3px; width:135px; ">
<nobr>
<input class="textfield" type="text" name="0_40" title="Branch/Plant" maxlength="12" value="*" style="vertical-align: top; width: 118px; cursor: auto;" onhelp="hp('0_40')" onmouseover="updateHelpCursor('',this)" tabindex="7" id="C0_40" htmlpostflag="false" onfocus="FCHandler.onFocusVA(this,'',false)" onkeydown="FCHandler.onKeyDownTextField(this,'','3', event,false,'UTC')" onmousedown="FCHandler.onKeyDownTextField(this,'','3', event)" onblur="FCHandler.onExitVA(this,false,'',false)">
I suspect that script cannot locate the element because it is generated by JavaScript, but when I use:
browser.execute_script("arguments[0].click();",z);
I doesn't work either. Is it possible to locate and click this element? What am I doing wrong? Big thank you for everyone who is going to spend his/her time trying to solve this issue.