[Solved] How to create and write a module for automation test framework

Just go with page object model. It’s simple only. Refer this link. http://toolsqa.com/selenium-webdriver/page-object-pattern-model-page-factory/ Ex: Keep Header.java and Move the locator elements to Header.java Similarly Catergory.java and Move the locator elements to Category.java Then SampleTest.java, Call the locator method in the test file…. That’s all……. solved How to create and write a module for automation test … Read more

[Solved] how to scrape web page that is not written directly using HTML, but is auto-generated using JavaScript? [closed]

Run this script and I suppose it will give you everything the table contains including a csv output. import csv from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC driver = webdriver.Chrome() wait = WebDriverWait(driver, 10) outfile = open(‘table_data.csv’,’w’,newline=””) writer = csv.writer(outfile) driver.get(“http://washingtonmonthly.com/college_guide?ranking=2016-rankings-national-universities”) wait.until(EC.frame_to_be_available_and_switch_to_it(“iFrameResizer0”)) wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, ‘table.tablesaw’))) … Read more

[Solved] When I run test in selenium using java, the alert gets closed but in code it shows failure

According to you, you are able to accept the alert but test step is showing exception in console : You can catch the exception and proceed further with your next steps: Below is the code : try { Alert myAlert = driver.switchTo().alert(); myAlert.accept(); } catch (Exception e) { System.out.println(“######### Successfully Accepted Alert ################”); } // … Read more

[Solved] How to create Gmail account using Selenium, I am having trouble with month and country drop downs

As I see at here the month drop down box is not actually a select element, you should try using Actions as below: WebDriverWait wait = new WebDriverWait(d, 10); Actions builder = new Actions(d); WebElement selectMonth = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(“//div[@title=”Birthday”]”))); builder.mouse.mouseMove(((Locatable)selectMonth).coordinates); selectMonth.click(); WebElement option = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(“//div[text() = ‘May’]”))); builder.mouse.mouseMove(((Locatable)option).coordinates); option.click(); System.out.println(“may slected…”); Edited: if you want to … Read more

[Solved] Can someone please explain technically the functionality of the below code [closed]

Why did they pass the src object to FileInputStream? Because FileInputStream will need a File to instantiate. src is an instance of File. Why did they pass FileInputStream object to xssfworkbook? Because XSSFWorkbook needs a FileInputStream to instantiate. fis is a FileInputStream. Why they did’nt pass any objects for xssfsheet? Because the sheet can be … Read more

[Solved] I am having trouble in locating search bus button in red bus site using selenium webdriver with java

As per the HTML you have shared to locate the Search Buses button and invoke click() you can use either of the following line of code : cssSelector driver.findElement(By.cssSelector(“button.fl.button#search_btn”)).click(); xpath driver.findElement(By.xpath(“//button[@class=”fl button” and @id=’search_btn’]”)).click(); Update With Selenium-Java Client v3.9.1 , GeckoDriver v0.19.1 and Firefox Quantum v58.0.2 this block of code works perfect at my end … Read more

[Solved] How to click on the Search company name button,type company name and search using Selenium and Python?

Try this: from selenium import webdriver import time from selenium.webdriver.common.keys import Keys from bs4 import BeautifulSoup from bs4.element import Tag driver = webdriver.Chrome(“C:/Users/RoshanB/Desktop/sentiment1/chromedriver_win32/chromedriver”) driver.get(‘http://www.careratings.com/brief-rationale.aspx’) time.sleep(4) companyArray = [] try: search = driver.find_element_by_name(‘txtSearchCompany_brief’) search.send_keys(“Reliance Capital Limited”) search.send_keys(Keys.RETURN) time.sleep(4) soup = BeautifulSoup(driver.page_source, ‘lxml’) companies = soup.find(“table”,class_=”table1″) for tag in companies.findChildren(): if isinstance(tag, Tag) and tag.name in ‘a’ … Read more

[Solved] What is the significance of the attribute xpath=”1″ while constructing locators for Selenium tests

That attribute (xpath=”1″) is placed there by a browser extension named CHROPATH. It is provided by a feature they call Dynamic Attribute Support. Scolling down the page one will find a text description of how to use the tool. Scroll to Note: at the bottom of the page, or search for “Note:” within the page … Read more