New answers tagged

1

// GIVEN that I am an anonymous user on the Instruct Counsel page driver.get("https://www.lexology.com/instructcounsel/find"); // WHEN I press the Example button driver.findElement(By.xpath("//div[@id='do-example-search']/button")).click(); driver.get should wait for the page to load, but that doesn't mean the button is ready to be ...


0

If you are sure that your search criteria is the text, you can use XPath: "//*[text()='Começa a new game']"


3

You are creating the Browser object inside the login function. When it ends, it is eligible for garbage collection. You can pass a pointer to an object outside the function, so it will still have a reference when the function ends. driver = webdriver.Chrome(executable_path="C:\Program Files (x86)\chromedriver.exe",options=chrome_options); login(&...


2

driver.get( "http://www.uitestingplayground.com/scrollbars") time.sleep(10) driver.execute_script( "arguments[0].scrollIntoView({'block':'center','inline':'center'})", driver.find_element_by_id("hidingButton")) https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView use inline and block options


1

from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,"xpath of drop down"))).click() WebDriverWait(driver,10).until(EC.visibility_of_element_located( (By.XPATH, "...


1

It will depend on what you want to tell in your code. If you want to remove the text "end-bubble bubble", then you can use replace: service_status.replace('end-bubble bubble','') If you want to explicitly only take the last word of the string, you can use deconstruction: _, _, last = service_status.split() Or if you want to be more cryptic (don't ...


1

You can use Python's .split() function. Change the last line of your script to print(service_status.split(' ')[2])


-1

If an xpath refers multiple elements on the DOM, It should be surrounded by brackets first () and then use numbering. if the xpath refers 4 elements in DOM and you need 3rd element then working xpath is (common xpath)[3]. If you are beginner and need more clarity watch https://youtu.be/k-znmPHjTF0


1

You can run Maven in dry run mode, so it will perform the maven test lifecycle, but without executing the tests: mvn release:prepare -DdryRun=true Then you can pipe the output into grep to look for the pattern that contains the info you are looking for.


1

You can make a call to TestRail's endpoint add_result_for_case. Example in Java: Map data = new HashMap(); data.put("status_id", new Integer(1)); JSONObject r = (JSONObject) client.sendPost("add_result_for_case/1/1", data); You can find the definition of the endpoint here. You can find the complete documentation here and some extra ...


1

ChromeOptions chromeOptions = new ChromeOptions(); String proxyadd = "176.9.119.170:8080"; Proxy proxy = new Proxy(); proxy.setHttpProxy(proxyadd); proxy.setSslProxy(proxyadd); chromeOptions.setCapability("proxy", proxy); WebDriver driver = new ChromeDriver(chromeOptions); There is a proxy class that can be used to set proxy including ...


1

Your element is not visible or covered by another opened element (for example dropdown, modal window). This is the exact same problem. Check it out https://stackoverflow.com/questions/44119081/how-do-you-fix-the-element-not-interactable-exception Make sure your element is visible before clicking it or sending text if it is an input field. You use: ((...


0

-Dcucumber.filter.tags="(@smoke or @dry)" You can also use -Dcucumber.filter.tags="(@smoke or @dry) and not @positive". Add this to CucumberOption to run the tags from your test runner class: tags = "(@smoke or @dry)" or tags = "(@smoke or @dry) and not @positive"


2

xpath: //*[contains(@id,"ember")]/input or //*[starts-with(@id,"ember")]/input css [id*="ember"]>input or [id^="ember"]>input is css for contains and ^ start with for css you can use any of the above locator to find the search field in linkedin


0

Try to get the attributes of the webElement2 which you are referring at your code. String aa = webElement2.getAttribute("text").toString();


0

try List<WebElement> list = driver.findElements(By.tagname("option")); list.get(<index number of the selection>).click();


0

You can use partial matches with css selectors. So where you have id=ember26 above, in that case, you could use: css=input[id^='ember'] (the ^ means starts with) You can also use endswidth, and contains. A great write up I found on all the different ways of handling dynamic cases will hopefully help.


0

As per my experience in a professional automation testing services organization, I will suggest you to use one of the below tools as per your current configuration i.e. Selenium / Maven / Java / IntelliJ Idea - TestNG - It is an automation testing framework which provides default HTML reports. Extent Reports - This report besides a consolidated execution ...


1

There are plenty. For example, if integrating with Jenkins, there's the Selenium HTML Report which allows you to drill down in the summary as well.


0

Use wait() method properly so that the desired element is visible/present. Your code seems okay. You can recheck the xpath of button. Use click() method instead of sendKeys(Keys.RETURN); // Click purchase button driver.findElement(By.xpath("//*[@id=\"chakra-modal--body-630\"]/button")).click();


0

const { Builder, By, Key, until } = require('selenium-webdriver'); let driver = new Builder() .forBrowser('chrome') .setChromeOptions( /* ... */ ) .setFirefoxOptions( /* ... */ ) .build(); driver.get("https://www.google.com/search?q=s&oq=s&aqs=chrome..69i57.210j0j15&sourceid=chrome&ie=UTF-8").then((...


0

Yes I have got the solution. WebElement QuizTab = driver.findElement(By.xpath("//*[@id="page-content"]/div/span[1]")); List tab = QuizTab.findElements(By.tagName("button")); System.out.println(tab); System.out.println(tab.size()); for(int i=0;i<tab.size();i++) { System.out.println(i); String tab1 = tab.get(i).getText(); ...


0

I don't really know why, but it works now. I gave the user im trying to work on with safaridriver the rights to change files of the computer. Also I seem to have used safaridriver (after giving more rights to the user) in python(I have no clue how I actually used it - but it works). So when I decided to try it again it now worked without the error described ...


Top 50 recent answers are included