Selenium click trouble(Python)

13 views
Skip to first unread message

Nka Nikoloz

unread,
Sep 29, 2016, 2:27:54 AM9/29/16
to Selenium Users

Using Selenium (chromedriver) to automate site chess,but I have trouble clicking on Peace and moving it.I have tried click() and ActionChains, but nothing work.Here is my code:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
T=r"C:\Users\HP\Downloads\chromedriver.exe"
options = webdriver.ChromeOptions()
options.add_argument("--start-maximized")
Driver=webdriver.Chrome(T,chrome_options=options)
Driver.get("https://www.chess.com/play/computer")
Driver.find_element_by_xpath('//*[@id="boardMessage"]/a').click()
Peace=WebDriverWait(Driver,10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="chessboard_boardarea"]/img[22]')))
Peace.click()

When I run script nothing happen,but white Pawn must highlighted in yellow. Can someone explain why click or ActionChains not working.And how can I make it work. P.S. If solution requires JavaScript help,please write it in more detail,because I don't know JavaScript at all.

Reply all
Reply to author
Forward
0 new messages