[Solved] scraping with selenium web driver

You should fix your XPath expressions. Use findElement for the first 3. findElements for the last. To get the home odd : //td[a[.=”bet365″]]/following-sibling::td[span][1]/span To get the draw odd : //td[a[.=”bet365″]]/following-sibling::td[span][2]/span To get the away odd : //td[a[.=”bet365″]]/following-sibling::td[span][3]/span To get them all : //td[a[.=”bet365″]]/following-sibling::td[span]/span Getting them all is probably better since you call driver.find_elements_by_xpath 1 time. … Read more

[Solved] How to count total number of products on webpage and verify if those are correct with Selenium webdriver in Java? [closed]

The below java code will help you do the task Here we create a driver instance go to the website url take all the products into a list and compare it with the text “1-15 of 38 Matching Products” public static void main(String[] args) { WebDriver driver=new FirefoxDriver(); driver.get(“http://www.samsung.com/us/video/home-audio/all-products”); List products = driver.findElements(By.className(“product-image”)); String pagination_no[]=driver.findElement(By.xpath(“//*[@id=’category_filter’]/section/div[1]/div/div[1]/h1″)).getText().split(” … Read more

[Solved] SyntaxError: Failed to execute ‘evaluate’ on ‘Document’: The string ‘xpath’ is not a valid XPath expression [duplicate]

If you look at the XPath in the error message, you will probably see what the issue is. Your text isn’t surrounded by quotes as is required, e.g. td[@area-label=November 2025] should be td[@area-label=”November 2025″] To fix this, you need to adjust your line of code to dp_month = driver.find_element_by_xpath(‘//*/td[@aria-label=”‘+month_label+'”]/div[contains(text(),”‘+ x_month +'”)]’) solved SyntaxError: Failed to … Read more

[Solved] How to click FindNow button in selenium webdriver? [closed]

So, the way to click this button currently with the two options you have requested. It doesn’t look like you can use the id since it changes each time the page is loaded. But if you can catch the dynamically generated id it would like like so: WebElement we5 = null; we5 = driver.findElement(By.id(“queryButton_ns_0S7SWJ42MS972TW2Z74G_1576_”)); we5.cl‌​ick(); … Read more

[Solved] Is there a way to select an option from dropdown other than using ‘Select’ class in Selenium?

Yes. The other way is, click on the dropdown menu and select the option from the dropdown using click method as below: WebElement ele = driver.findElement(By.xpath(“<Xpath of dropdown element>”)); // To find the dropdown web element List<WebElement> options = driver.findElements(By.xpath(“<Xpath of dropdown Options”)); // To find the dropdown options ele.click(); // To click on the … Read more

[Solved] How to use TestNg in Selenium WebDriver?

Hi TestNG can be defined as 1.TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing (testing a class in isolation of the others) to integration testing (testing entire systems made of several classes, several packages and even several external frameworks, such as application servers). 2.For official TestNG … Read more

[Solved] htmlunit driver gives me com.gargoylesoftware.htmlunit.html.HtmlPage cannot be cast to com.gargoylesoftware.htmlunit.InteractivePage error

htmlunit driver gives me com.gargoylesoftware.htmlunit.html.HtmlPage cannot be cast to com.gargoylesoftware.htmlunit.InteractivePage error solved htmlunit driver gives me com.gargoylesoftware.htmlunit.html.HtmlPage cannot be cast to com.gargoylesoftware.htmlunit.InteractivePage error

[Solved] Selenium @FindBy linkText or @FindBy partialLinkText not working

As per the HTML you have shared you can use either of the following solutions: linkText: @FindBy(linkText = “My transfer”) WebElement transferBtn; partialLinkText: @FindBy(partialLinkText = “transfer”) WebElement transferBtn; xpath: @FindBy(xpath = “//a[contains(.,’My transfer’)]”) WebElement transferBtn; solved Selenium @FindBy linkText or @FindBy partialLinkText not working

[Solved] c# selenium if else check [closed]

This is what you are asking for if (rows == null) { continue; } else { rows.ElementAt(0).Click(); break; } However it’d be better code practice and more efficient to use a while loop implementation instead; IReadOnlyCollection<IWebElement> rows = null; bool rowsFound = false; while (!rowsFound) { rows = driveri.FindElements(By.XPath(“//*[@id=\”app\”]/div/span[3]/div/div/div/div/div/div/div[2]/div”)); if(rows!=null) { rowsFound = true; } … Read more

[Solved] How to demonstrate a real time example of using BeforeTest, AfterTest, BeforeSuite, AfterSuite, BeforeClass, AfterClass annotations in TestNG

How to demonstrate a real time example of using BeforeTest, AfterTest, BeforeSuite, AfterSuite, BeforeClass, AfterClass annotations in TestNG solved How to demonstrate a real time example of using BeforeTest, AfterTest, BeforeSuite, AfterSuite, BeforeClass, AfterClass annotations in TestNG

[Solved] Is it possible for WebDriver to click an element with a mouseclick event that invokes a JavaScript file that includes a test tracker?

Is it possible for WebDriver to click an element with a mouseclick event that invokes a JavaScript file that includes a test tracker? solved Is it possible for WebDriver to click an element with a mouseclick event that invokes a JavaScript file that includes a test tracker?

[Solved] how to select custom dropdown list element from selenium

The currently recommended method of selecting an item from a dropdown menu is to use the Select class. Here’s a quick example: from selenium.webdriver.support.ui import Select from selenium import webdriver browser = webdriver.Firefox() browser.get(“file:///C:\testing\\test.html”) element = browser.find_element_by_id(“id_country”) select = Select(element) select.select_by_visible_text(“Armenia”) However, the HTML you posted doesn’t seem to work; I just get an empty … Read more

[Solved] TestNG framework, @Test Annotation code is not working

Please ensure below things: 1. Importing testngimport org.testng.annotations.Test; 2.If maven, add below dependency to POM.xml <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.9.10</version> </dependency> <dependency> 3.Import Testng.jar in case of non-maven project. If still issue persists, kindly post error message. solved TestNG framework, @Test Annotation code is not working