I'm new to python and trying to convert my selenium-Java scripts into selenium-python. I've been struggling to convert below code. Well, this is running successfully with Selenium-Java.
I got stuck wherein i would like to get the attribute value at a particular location and converting it to a string.
String indx=element.getAttribute("num");
int k=Integer.parseInt(indx);
element.sendKeys(""+a[k]);
How do I get that running in Python? Thank you
char a[]={'0','p','a','s','s','w','o','r','d','1'};
for(int i=1;i<=3;i++) {
try {
WebElement element = driver.findElement(By.id("pff"+i));
if(element != null) {
String indx=element.getAttribute("num");
int k=Integer.parseInt(indx);
element.sendKeys(""+a[k]);
}
}
catch(Exception e){
}
}
a=['0','p','a','s','s','w','o','r','d','1'],indx=element.getAttribute("num"), andk=int(indx). Does that help?a = "0password1". Also, I think it should be.get_attribute("num")for python.