1

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.

enter image description here

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()

1 Answer 1

2

I managed to solved the problem by performing double_click twice and send_keys('\ue017')to clear the textarea

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.