Issue
Hi i m not familiar with stack overflow, i would like some help to solve this problem: I manage to get a list of webElements with their xpath and my end goal is to search paste each one of them (1 at the time) in the google search bar. My idea was to copy the List(webElements) to an other List so that i can store those(string)values and 1 at the time search for them. the code look like this:
nome = wd.find_elements_by_xpath('/html/body/div[2]/div/div[3]/div/div/div[2]/div/ul/li')
elements=[]
for i in range(0,40):
nome[i].text=elements[i]
wd.get('https://google.com')
#accepts cookies wd.find_element_by_xpath('/html/body/div[2]/div[2]/div[3]/span/div/div/div/div[3]/button[2]/div').click()
for i in range(0,40):
wd.get('https://google.com')
wd.find_element_by_xpath('/html/body/div[1]/div[3]/form/div[1]/div[1]/div[1]/div[2]/div[2]/input').send_keys(elements[i])
Solution
elements=[elem.text for elem in none]
Is what you are trying to do. Go through each element in none and grab the .text.
Answered By - Arundeep Chohan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.