xpath - Python code to click on anchor tag -
i writing python code automate web page. need click on play button play recording. not able through code.
inspect element gives me - outer html of 'play' :
<div class="play"> <a id="sm_1855464769" class="sm2_button" href="#"> </a> </div> inspect element gives me - xpath of 'play' :
//*[@id="recording_1855464769"]/div/div/div[8] the python code wrote :
element = webdriverwait(self.driver, 15).until(ec.presence_of_element_located(ec.find_element_by_xpath("//*[@id='recording_1855464769']/div/div/div[8]")) element.click() error message in terminal :
element = webdriverwait(self.driver, 15).until(ec.presence_of_element_located(ec.find_element_by_xpath("//*[@id='recording_1855464769']/div/div/div[8]"))) attributeerror: 'module' object has no attribute 'find_element_by_xpath' i need click on anchor tag in order play audio. how can ?? plz help..
you need use by. replace ec.find_element_by_xpath by.xpath.
from selenium.webdriver.common.by import element = webdriverwait(self.driver, 15).until(ec.presence_of_element_located (by.xpath("//*[@id='recording_1855464769']/div/div/div[8]"))
Comments
Post a Comment