Issue with right click operations in selenium action chains | Selenium Python Forum
A
Anand komiripalem Posted on 29/10/2020

Hi,

im trying to right-click on the page and select one option from the available options but nothing is happening with the send_keys() methods. i'm pasting the code here please let me know where im going wrong.

 

from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys

op = webdriver.ChromeOptions()
op.add_argument("--disable-notifications")
op.add_argument("--start-maximized")

driver = webdriver.Chrome(options=op)

driver.get("https://jqueryui.com/draggable/")

frames = driver.find_elements_by_tag_name("iframe")

print(len(frames))

driver.switch_to.frame(0)

drag = driver.find_element_by_id("draggable")

print(drag.location['x'])
print(drag.location['y'])


webdriver.ActionChains(driver).drag_and_drop_by_offset(drag, 100, 100).perform()

webdriver.ActionChains(driver).context_click().send_keys(Keys.ARROW_DOWN).perform()

#webdriver.ActionChains(driver).context_click().send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()


time.sleep(15)
driver.quit()

 

Thanks in advance and also i have posted a query regarding multi option select but still not got the clarification. please look into it

 

 


J
Jaspreet Replied on 04/11/2020

Hey

When you are using "context_click()", pass the element in the arguments on which you actually want to click. It will work fine.

Regarding the second query, soon the solution will be provided.


Related Posts