[Solved] Selenium – How to confirm that captcha with two numbers are changed after submit [closed]

Here is the line of code that you have to use the before clicking submit and after clicking submit. Then compare they are not matching. driver.findElement(By.xpath(“//span[@class=”et_pb_contact_captcha_question”]”)).getText(); 0 solved Selenium – How to confirm that captcha with two numbers are changed after submit [closed]

[Solved] Print statement only once in a while loop (Python, Selenium) [closed]

You just need to change the order of your code, and you don’t need an if..else statement. Let it default to “Checking availability…”, and then start your loop which will refresh the page every 45 seconds until that text you specified is gone from driver.page_source driver.get(“Link of product site.”) print(“Checking availability…”) while “Not available right … Read more

[Solved] How to solve java.lang.NoClassDefFoundError? Selenium

The error says it all : java.lang.NoClassDefFoundError: com/google/common/base/Function at MainTest.openGoogle(MainTest.java:15) While working with Selenium v3.x you have to download geckodriver.exe from mozilla/geckodriver and place it in your system. Next you have to set the system property through the line System.setProperty() as follows and provide the absolute path of the GeckoDriver binary within your system as … Read more

[Solved] Unable to capture records name , price and rating and image in Requests Python [closed]

You have to scrape the adidas site and use regex: import requests import re endpoint = “https://www.adidas.com.au/continental-80-shoes/G27707.html” headers = { ‘User-Agent’: ‘Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36’ } response = requests.get(endpoint, headers = headers) data = response.text pricereg = r”(?<=\”price\”:)(.*)(?=,\”)” namereg = r”(?<=\”name\”:)(.*)(?=,\”co)” ratingreg= r”(?<=\”ratingValue\”:)(.*)(?=,\”reviewCou)” price = re.search(pricereg, data, re.MULTILINE).group() name … Read more

[Solved] Unit Testing (e.g.Specflow) vs Selenium [closed]

This would deeply depend on the whole development lifecycle approach. In an ideal world, developers write unit tests. But someone else needs to test their work (2nd pair of eyes). So a tester would also write tests (whether automated or manual test scripts). Cucumber & TestNG basically work like Unit Tests do, Cucumber specifically is … Read more

[Solved] Using IF commands to Check if a button exists in Selenium Java [closed]

You may try this: public void ClickButton () throws InterruptedException { WebElement button = driver.findElement(By.id(“button”)); String Source = driver.getPageSource(); if (Source.contains(button)) { button.click(); Thread.sleep(3000); } else { driver.quit; } } Hope this can be helpful. Let me know if you are still facing problem. solved Using IF commands to Check if a button exists in … Read more

[Solved] How to resolve the Exception in thread main

From your code it seems you are switching to a frame in getIframe. But forgot to switch to default[ driver.switchTo().defaultContent();] once your opertation is done public String getIframe(String id) { String Value = “”; final List<WebElement> iframes = driver.findElements(By.tagName(“iframe”)); for (WebElement iframe : iframes) { if (iframe.getAttribute(“id”).equals(id)) { driver.switchTo().frame(id);//switch happens Value = driver.findElement(By.xpathdfdgdg”)).getText(); System.out.println(“erer” + … Read more

[Solved] How to get the text of an anchor tag selected by xPath() using selenium and Mocha

You can try this approach: driver.findElement(By.xpath(“//a[contains(@class, ‘user-name m-r-sm text-muted welcome-message’)]”)).getText().then(function(text){ console.log(“Username : ” + text); }); you only need to search via findElement (not findElements) and directly extract the text before the function part UPDATE: Sometimes the object is not really hidden, but also not in the viewport, then gettext() also returns an empty String. … Read more