I know there is a lot of question like this on StackOverflow but honestly none of them give any explanation or help for the problem. I have been browsing the web for 2 days and haven't find any solutions as well. So, please before answering anything, read the whole message. Thanks!
<tr class="table-header font14 draggable">
<th class="font-format-big" style="padding: 0.5em; text-align: center;"><span>Example Text</span></th>
<th class="font-format-big" style="padding: 0.5em; text-align: center;"><span style="min-width: 53px; display: inline-block;">Example Text</span></th>
<th class="font-format-big" style="padding: 0.5em; text-align: left;" draggable="false"><span>Example Text</span></th>
<th class="font-format-big" style="padding: 0.5em; text-align: left;" draggable="false"><span>Example Text</span></th>
<th class="font-format-big" style="padding: 0.5em; text-align: left;" draggable="false"><span>Example Text</span></th>
<th class="font-format-big" style="padding: 0.5em; text-align: left;" draggable="false"><span>Example Text</span></th>
<th class="font-format-big" style="padding: 0.5em; text-align: left;" draggable="false"><span>Example Text</span></th>
<th class="font-format-big" style="padding: 0.5em; text-align: left;" draggable="false"><span>Example Text</span></th>
<th class="font-format-big" style="padding: 0.5em; text-align: left;" draggable="false"><span>Example Text</span></th>
</tr>
This is a web element code. I cannot share the link or full code, since it's an "inside the company" tool. What my goal is, is to rearrange elements of th tag. For example I need to switch th[5] with th[4]. To add more. I see that the status of the element displayed as draggable='false'. Hoverer, if I click on the element it changes to draggable='true'.
Things that I've tried:
source = driver.find_elements_by_tag_name('th')
ActionChains(driver).click_and_hold(source[8]).pause(2).move_to_element(source[0]).release(source[8]).perform()
Outcome: It clicked on the source[8], but that's all.
source = driver.find_elements_by_tag_name('th')
ActionChains(driver).click_and_hold(source[8]).pause(2).move_to_element(source[0]).release(source[0]).perform()
Outcome: Same. It clicked on the source[8], but that's all.
platform_source = driver.find_element_by_xpath("//th[1]") *example xpath
platform_target = driver.find_element_by_xpath("//th[9]") *example xpath
time.sleep(1)
ActionChains(driver).drag_and_drop(platform_source, splatform_target).perform()
Outcome: And same. It clicked on the platform_source, but that's all.
platform_source = driver.find_element_by_xpath("//th[1]") *example xpath
platform_target = driver.find_element_by_xpath("//th[9]") *example xpath
time.sleep(1)
ActionChains(driver).click_and_hold(platform_source) *to change it to draggable="true"
ActionChains(driver).drag_and_drop(platform_source, platform_target).perform()
Outcome: Still Nothing.
If someone can pinpoint where is a problem, or if there is a different libraries I can use together with Selenium to perform such actions, I would be very grateful for it. Thanks!