Reputation:
I'm new to python and Selenium , I'm working on a little project of create a bot automate extract data from Binance, I encounter some problem that I failed to clear()
the date and time (html highlighted in pic below) before i send_keys
the values that I pass into. I couldn't find any solution online , Hope that someone would help me.
Here's the python code I work on
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
#open binance margin site
website = 'https://www.binance.com/en/trade-margin/BTC_USDT'
path = '/Users/admin/Downloads/chromedriver'
driver = webdriver.Chrome(path)
driver.get(website)
#right click go to date
actions = ActionChains(driver)
right_click = driver.find_element_by_xpath('//div[@class="kline-container css-vurnku"]')
actions.context_click(right_click).perform()
#open_date
open_date = driver.find_element_by_xpath('//div[@class="css-17nms4o"]')
actions.click(open_date).perform()
#clear textarea field
clear_text = driver.find_element_by_class_name("rc-picker-input")
actions.clear(clear_text).perform()
Upvotes: 1
Views: 167
Reputation:
I managed to solved the problem by performing double_click
twice and send_keys('\ue017')
to clear the textarea
Upvotes: 2