I cant use send_Keys() method to input values in the current website im working on.
So im trying to use javascript to input values.
i tried click() and clear() together with send_keys() before i decided to use javascript but to my disappointment, it didnt work.
i use the javascript code to input value below
driver.execute_script("document.getElementById('CustCd').setAttribute('value', 'J590')")
and it worked.
But currently my code is inside a loop and the value changes, how can i replace J590 with a variable that gets the value?
Here is the code that i tried
ccr_No = XLUtlis.readData(path, 'ccr', r, 1)
driver.execute_script("document.getElementById('CCRNo').value=ccr_No")
I know its wrong, any help would be appreciated. My Javascript is weak.
Just some side note if anybody would be able to solve my send_keys() error.
The function only takes in the first character that i send. For example, send_keys("J590") gives J, send_keys("J590-TE21") gives J-

document.getElementById('CustCd').value = 'J590';driver.execute_script("document.getElementById('CCRNo').value='" + ccr_No + "'")soccr_Noisn't literal text in the string...? But ifccr_Nocould contain'or a backslash, you'll need to escape it.setAttribute()will work just fine.valueattribute and thevalueproperty are very different animals.setAttributemight work as a side effect of changing the default value, but it's not correct.