I had a file upload functionality, which worked very well by using below code
self.driver.find_element_by_xpath('some_xpath').send_keys('/tmp/my_file.csv')
But now due to some recent changes, i cannot find this element by xpath. Few components are merged in angular and xpath approach wont work now.
I am able to click on file upload button using actions:
el = self.driver.find_element_by_xpath("some_other_xpath_which_i_can_find")
action = webdriver.common.action_chains.ActionChains(self.driver)
action.move_to_element_with_offset(el, 150, 70).click().perform()
This opens file selection modal successully.
However, send key does not work.
el = self.driver.find_element_by_xpath("some_other_xpath_which_i_can_find")
action = webdriver.common.action_chains.ActionChains(self.driver)
action.move_to_element_with_offset(el, 150, 70).send_keys("/tmp/my_file.csv").perform()
I am getting this error:
AttributeError: 'ActionChains' object has no attribute "'id'"
I am struggling to solve this for hours. Tried everything available on internet. Please guide.