'How to access multiple customers with the dropdown in selenium webdriver Python
How to access multiple customers with the dropdown menu by choosing one customer at a time(select_by_visible_text('Customer1', 'Customer2', Customer3) and clicking the send email button with an interval of 3 seconds for each customer?
In dropdown site:
<select name="customer_id" class="customer_id" style="width: 200px">
<option value></option>
<option value=="164">Customer1</option>
<option value="185">Customer2</option>
<option value="80">Customer3</option>
<option value="259">Customer4</option>
Choose Customer1 in dropdown
Insert email
Click on the Button_Send
Wait 3 second time
Choose Customer2
Insert email
Click on the Button_Send
Wait 3 second time
Choose Customer3
Insert email
Click on the Button_Send
Wait 3 second time
Choose Customer4
Insert email
Click on the Button_Send
Wait 3 second time
from selenium import webdriver
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.by import By
import time
navegador = webdriver.Chrome()
url = 'www.testblablabla34572211.com'
email = '[email protected]'
navegador.get(url)
time.sleep(2)
navegador.refresh()
time.sleep(2)
dropdownField = navegador.find_element(By.NAME,('customer_id'))
select = Select(dropdownField)
options = select.select_by_visible_text('Customer1')
options = select.select_by_visible_text('Customer2')
options = select.select_by_visible_text('Customer3')
#Select Customers
dropdownField = browser.find_element(By.NAME,('customer_id'))
select = Select(dropdownField)
select.select_by_visible_text('Customer1')
time.sleep(1)
# Click on the Email field:
browser.find_element(By.ID,'email').click()
time.sleep(1)
# Insert email
browser.find_element(By.ID,'email').send_keys(email)
time.sleep(1)
# Click the button to send the email
browser.find_element(By.ID,'Button_Send').click()
time.sleep(3)
navegador.close()
#End#
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
