Hello all,
1. Then Click on "AUD" currency selector dropdown.
2. In search bar, to enter "Ind"
3. Then select "Indonesian Rupiah" in the expanded dropdown.
4. Lastly, click on continue button.
Below is my code in pycharm IDE:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support import expected_conditions as EC
import time
service_object = Service(r"C:\Users\Admin\Downloads\chromedriver-win64\chromedriver-win64\chromedriver.exe")
driver = webdriver.Chrome(service=service_object)
driver.get("https://bitcoin.org/en/")
time.sleep(5)
element_click = [(By.XPATH, '//*[@id="menusimple"]/li[4]/ul/li[2]/a'),
(By.XPATH, '//*[@id="widget-modal-root"]/div[2]/div[1]/div[1]/div/div/div/div[2]/button')]
for by_method, value in element_click:
try:
#Selecting participate menu and buy bitcoin submenu
element_buy_Bitcoin = WebDriverWait(driver, 100).until(EC.presence_of_element_located((by_method, value)))
driver.execute_script("arguments[0].click();", element_buy_Bitcoin)
time.sleep(10)
print(f"Clicked on participate and buy bit coin")
time.sleep(10)
#Clicking on currency dropdown
WebDriverWait(driver, 100).until(EC.presence_of_element_located(
(By.XPATH, '//*[@id="widget-modal-root"]/div[2]/div[1]/div[1]/div/div/div/div[2]/button/p'))).click()
time.sleep(20)
#Entering search critera in currency search field
enter_ind = WebDriverWait(driver, 60).until(EC.presence_of_element_located(
(By.XPATH, '//*[@id="widget-modal-root"]/div[2]/div[1]/div[1]/div[1]/div[2]/div/input')))
driver.execute_script("arguments[0].value='Ind';", enter_ind)
time.sleep(10)
#Slecting Indonesian Rupiah
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((
By.CLASS_NAME, "flex w-full ml-2 text-left"
))).click()
time.sleep(10)
except Exception as e:
print("Not clickable")
driver.quit()
The output is
Clicked on participate and buy bit coin
Clicked on {element_buy_Bitcoin}
Not clickable
Process finished with exit code 0