4
I am using Selenium as Crawler on a website. I have no experience with python.
Here I create a dataframe with the data of a .csv
df = pd.DataFrame.from_csv(
'tabela_etickets_copa3.csv',
columns = header
)
open the browser, enter the site, find the elements and Seto my variables
driver = webdriver.Firefox()
driver.get("xxxxxxx")
bref = driver.find_element_by_name("ctl00$SPWebPartManager1$g_1eba1641_45a3_4029_be3a_175e90e68a47$input_manage_num_reservation")
lname = driver.find_element_by_name("ctl00$SPWebPartManager1$g_1eba1641_45a3_4029_be3a_175e90e68a47$input_manage_lastname")
botao = driver.find_element_by_xpath("//button[text()='Continuar']")
Finally I spin a loop with for
to pick up items from .csv
, insert into the site and squeeze enter
for index, row in df.iterrows():
lname.send_keys(row['PAX'].rsplit("/",1)[0]
botao.send_keys(Keys.RETURN)
driver.close()
I’m making that mistake:
botao.send_keys(Keys.RETURN)
^
SyntaxError: invalid syntax
What I understand here is that most commands after the for
do not work. Can anyone suggest me something ?
I think you’re missing one
)
here:lname.send_keys(row['PAX'].rsplit("/",1)[0]
– Sergio
@Lucascobino Your question is being closed because apparently it is only a typo, as demonstrated by Sergio. Can you confirm whether this is the case or not? If it is not, please edit your question to clarify this point and avoid closing (or reopen if the question has already been closed).
– Victor Stafusa
That’s right, you can close.
– scob