I am trying to loop csv rows into the selenium elements but program takes all rows and putting them into elements.
Here is the code
def send_keys_textboxes(self,url):
bot = self.bot
bot.get(url)
data = pd.read_csv("translations.csv")
# I am not sure np is important but anyway
langs = np.array(data)
# These are clickable elements which opens popups
elements = bot.find_elements_by_xpath("//a[@data-tag='globalize']")
for elem in elements:
class_of_element = elem.get_attribute("class")
if class_of_element == 'cs-trans-icon':
# Opens popup (panel)
elem.click()
time.sleep(3)
# Select all textboxes
textBoxes = bot.find_elements_by_tag_name('textarea')
# Send values in a row to textboxes
# PROBLEM HERE: It is sending 3 value in each textbox
for phrase in langs:
for i in range(len(phrase)):
textBoxes[i].send_keys(phrase[i].title())
So, there are textboxes and csv of translations. I am sending first value to first textbox, second value to second textbox. But everytime it is sending all data inside csv.
For instance, my csv contains 3 rows and I have 3 panel with texboxes. First row must be send to first panel, second row must be send to second panel and so on..
So, value in rows are already sending to textboxes but as I stated it is all 3 rows, I need to loop somehow to make it work properly.
