How can I concatenate a variable with another string variable in Selenium?
For example, Date0,Date1,Date2..etc are variables and have the actual time and date.
Here is the code:
dar = time.localtime(time.time())
das = time.localtime(time.time() + 86400)
Date0 = time.strftime("%Y-%m-%d",dar)
Date1 = time.strftime("%Y-%m-%d",das)
The problem in Selenium I'm facing while executing the Python script
for i in range(5):
for j in range(4,7):
if (str(i) == '0' or str(i) == '1' or str(i) == '2' or str(i) == '3' or str(i) == '4')and(str(j) == '4' or str(j) == '5' or str(j) == '6'):
hrs_fill = driver.find_element_by_xpath("//*[@id='"+ Date+str(i) +"_50"+ str(j) +"_166003-5_hrs']")
hrs_fill.send_keys('3')
break
Getting the error:
NameError: name 'Date' is not defined
It's considering Date as separate variable and str(i) as separate variable not as combined