xpath

Python Selenium SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//div[contains(@class, 'product-card__subtitle')

帅比萌擦擦* 提交于 2021-02-04 08:09:32
问题 Trying to get the XPath of div class and the text inside of the div. the two divs are: <div class="product-card__subtitle">Women's Shoe</div> <div class="product-card__subtitle">Men's Shoe</div> My Xpaths that are giving the selenium error are: driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text(" ")='Women's Shoe']") driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text()='Men's " "Shoe']") I am trying to get the path for

How to click within the username field within ProtonMail signup page using Selenium and Java

筅森魡賤 提交于 2021-02-04 08:08:40
问题 I'm not able to make it Wright in an username at https://mail.protonmail.com/create/new?language=en. For some reason it cant find or cant klick at "choose username", Can any one help me out? Code trials: public class LaunchApplication { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "C:\\chromedriver_win32\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); int number = 1; String

Getting specific elements in selenium

二次信任 提交于 2021-02-04 08:01:33
问题 I am trying to get the elements displayed as N06D-X N07X R01A-C01 S01G-X01 in the following image: Now, I got something like the WebDriver in this way: who = driver.find_element_by_tag_name("span").find_elements_by_tag_name("p") and get an output like this: [<selenium.webdriver.remote.webelement.WebElement (session="1c044455cf883fdedf6845bcd456bfab", element="0.23338884730774767-2")>] I am working on Mac Catalina and when I type: who.text it returns an empty list for some reason. I got quite

Python Selenium cant find the Add photo and video button element on Facebook

拈花ヽ惹草 提交于 2021-02-02 09:55:13
问题 Im trying to upload an image to facebook and im unable to click on the Add photo and video button. When im looking at the html this is the element im trying to click: <input aria-label="Add Photo or Video" accept="video/*, video/x-m4v, video/webm, video/x-ms-wmv, video/x-msvideo, video/3gpp, video/flv, video/x-flv, video/mp4, video/quicktime, video/mpeg, video/ogv, .ts, .mkv, image/*, image/heic, image/heif" containerclassname="_5g_r" multiple="" name="composer_photo[]" display="inline" role=

selenium.common.exceptions.NoSuchWindowException: Message: no such window error clicking an element within an iframe using Selenium and Python

不羁岁月 提交于 2021-02-02 09:53:48
问题 I'm starting with Selenium and have a question, basically I don't understand why when I switch to an iframe and select one of the elements I constantly get: selenium.common.exceptions.NoSuchWindowException: Message: no such window (Session info: chrome=84.0.4147.89) This is the relevan code, firstly I click on some element of the DOM containing the iframe that actually updates the iframe content and then select the iframe, switch to it and then select the element I want inside the HTML

selenium.common.exceptions.NoSuchWindowException: Message: no such window error clicking an element within an iframe using Selenium and Python

倾然丶 夕夏残阳落幕 提交于 2021-02-02 09:53:45
问题 I'm starting with Selenium and have a question, basically I don't understand why when I switch to an iframe and select one of the elements I constantly get: selenium.common.exceptions.NoSuchWindowException: Message: no such window (Session info: chrome=84.0.4147.89) This is the relevan code, firstly I click on some element of the DOM containing the iframe that actually updates the iframe content and then select the iframe, switch to it and then select the element I want inside the HTML

selenium.common.exceptions.NoSuchWindowException: Message: no such window error clicking an element within an iframe using Selenium and Python

倖福魔咒の 提交于 2021-02-02 09:53:24
问题 I'm starting with Selenium and have a question, basically I don't understand why when I switch to an iframe and select one of the elements I constantly get: selenium.common.exceptions.NoSuchWindowException: Message: no such window (Session info: chrome=84.0.4147.89) This is the relevan code, firstly I click on some element of the DOM containing the iframe that actually updates the iframe content and then select the iframe, switch to it and then select the element I want inside the HTML

Automating jQuery based bootstrap dropdown using Selenium and Java

三世轮回 提交于 2021-02-02 09:38:30
问题 I am trying to list all elements from the bootstrap dropdown and then select a certain value. However, it returns 0 values. Any suggestions will be greatly appreciated. driver.findElement(By.id("imgSelectButton")).click(); Thread.sleep(3000); List<WebElement> list = driver.findElements(By.xpath("//ul/li[@class='logoSelectOpt']//li")); System.out.println(list.size()); for(int i=0; i<list.size(); i++){ System.out.println(list.get(i).getText()); if (list.get(i).getText().contains("History")){

Automating jQuery based bootstrap dropdown using Selenium and Java

徘徊边缘 提交于 2021-02-02 09:37:07
问题 I am trying to list all elements from the bootstrap dropdown and then select a certain value. However, it returns 0 values. Any suggestions will be greatly appreciated. driver.findElement(By.id("imgSelectButton")).click(); Thread.sleep(3000); List<WebElement> list = driver.findElements(By.xpath("//ul/li[@class='logoSelectOpt']//li")); System.out.println(list.size()); for(int i=0; i<list.size(); i++){ System.out.println(list.get(i).getText()); if (list.get(i).getText().contains("History")){

How to paginate through the page numbers when href contains javascript:__doPostBack()

别来无恙 提交于 2021-02-02 09:36:27
问题 I'm trying to scrape this website http://www.mfa.gov.tr/sub.ar.mfa?dcabec54-44b3-4aaa-a725-70d0caa8a0ae but when I want to go to next page I can't because the link doesn't change you will find that pages links are like that href="javascript:__doPostBack('sb$grd','Page$1')" I have a code that I tried but it only goes to page 2 and then gave me an error: tale element reference: element is not attached to the page document from selenium import webdriver url = 'http://www.mfa.gov.tr/sub.ar.mfa