Issue
I need CFBundleversion of my apps so i've tried scrapy iTunes Connect website but i can't get element.
I tried:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://appstoreconnect.apple.com/login")
elem = driver.find_element_by_xpath("//input[@id='account_name_text_field']")
I am receiving the following error:
elenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //input[@id='account_name_text_field']
i think the site is different structure... what should i do?
Solution
Nothing wrong with you locator :
driver.find_element_by_xpath("//input[@id='account_name_text_field']")
It inside iframe
, you need switch first, use frame_to_be_available_and_switch_to_it
and visibility_of_element_located
, like this:
driver.get('https://appstoreconnect.apple.com/login')
WebDriverWait(driver, 30).until(expected_conditions.frame_to_be_available_and_switch_to_it((By.ID, "aid-auth-widget-iFrame")))
WebDriverWait(driver, 30).until(expected_conditions.visibility_of_element_located((By.XPATH, "//input[@id='account_name_text_field']")))
elem = driver.find_element_by_xpath("//input[@id='account_name_text_field']")
elem.send_keys("userName")
Following import:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
Answered By - frianH
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.