There is a span dropdown and inside there are 3 more dropdowns. I need to first select "home" and then "task tracking" and the option in that drop down.
I have seen the iframe
present in the source code and I am not able to find and put the solution in my python code.
Both find_element_by_css_selector
and find_element_by_xpath
are giving the error
Errors- AttributeError: type object 'By' has no attribute 'tagName'
This is my code:
size = self.driver.find_element(By.tagName("iframe"))
print(size)
self.driver.find_element_by_css_selector('#TitleCaret').click() #Drop down
sleep(10)
self.driver.find_element_by_css_selector('#chrome-sidebar > div > div.chrome-links > ul > li:nth-child(1) > a').click() #Select Director from drop down
#self.driver.find_element_by_xpath('//*[@id="LoanBar"]/span[2]/button').click()
size = self.driver.find_element(By.tagName("iframe"))
print(size)
WebDriverWait(self.driver, 30).until(EC.frame_to_be_available_and_switch_to_it(By.ID, self.iframe_id))
sleep(10)
self.driver.switch_to.frame(self.iframe_id)
#self.driver.switch_to.frame('ifr_APP')
self.driver.find_element_by_css_selector('#LoanBar > span.dropdown > button').click()
CodePudding user response:
Selenium in Python has By.TAG_NAME
attribute.
By.tagName
is Selenium Java syntax.
CodePudding user response:
it's self.driver.find_element(By.TAG_NAME,"iframe")