Selenium

Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages, including C#, Groovy, Java, Perl, PHP, Python, Ruby and Scala. The tests can then be run against most modern web browsers. Selenium deploys on Windows, Linux, and OS X platforms. It is open-source software, released under the Apache 2.0 license, and can be downloaded and used without charge.

Share tech news, updates, or what's on your mind.

Sign up to Post

from selenium import webdriver
dr=webdriver.Chrome()
dr.get('https://www.google.com')
text=str('good day ')
dr.execute_script("document.getElementById('lst-ib').setAttribute('value','"+text+"')")


This works fine , but when i use xpath
dr.execute_script("document.getElementByXPath('//*[@id='lst-ib']').setAttribute('value','"+text+"')")

I am getting Error . Kindly anyone help me with this
0
Will You Be GDPR Compliant by 5/28/2018?
LVL 1
Will You Be GDPR Compliant by 5/28/2018?

GDPR? That's a regulation for the European Union. But, if you collect data from customers or employees within the EU, then you need to know about GDPR and make sure your organization is compliant by May 2018. Check out our preparation checklist to make sure you're on track today!

Hi there!

I have an issue preparing an installation of Python/IDLE in one of my client's team computers. Basically, I prepared a couple of scrappers using Python and Selenium. The packages being used on my scripts are selenium, openpyxl, and python-docx.
However, I can't even get to installing the packages on that machine, because one I execute the Python installer from the website (3.6.x), the insteller won't. I tried using admin rights, disabling antivirus, I checked the correct processor architecture, and I still can't get to run the installer on that particular machine. In other team members I was able to installe in their machines. I have run out of ideas to trouble shoot this. Could you please point me to things that I can try out to run the installer Python/IDLE installer?

Thank you so much!
Any help is greatly appreciate it.
0
Hi,

This about automating the Application verification.

As part of testing we are verifying some online application every day and seeing the response at the end and confirming that the application working as expected.

Cant we automate this process. If we did that it will reduce 30 mints of our time. Also if this can be done from the UFT tool also fine for me. we dont have selenium in our machine and it is not allowed. Please share your thougths and suggestions if any.
0
What are steps to install selenium automation in robot framework in ubuntu 16.04 in python?
0
I am using Log4j2 with the JUL plug-in.

For example:
	... 18 more
1500642924477	Marionette	INFO	New connections will no longer be accepted
1500642924501	addons.xpi	DEBUG	Calling bootstrap method shutdown on webcompat@mozilla.org version 1.1

Open in new window

0
We are using ELK(Elastic search, logstash, and Kibana) for our log management. Everytime I will export the setting from kibana UI from Management--->Save Objects--->Export Everything. For demo, one can checkout the url: Kibana Demo

cURL
I want to automate this export process with some scripting on linux. I tried CURL but the header/payload data looks to be dynamic and might have to update frequently. I want to try some web scraping techniques with some web automation tools like Selenium and pythion.

Selenium Webdriver
I tried to record this export action with Selenium IDE and from the IDE I exported the test plan/case into pythonkibana_python.py . As we click on Export Everything button on Kibana, a firefox window opens asking where to save. This action is not handled by selenium, meaning download file is not supported by selenium.

So, I'm looking for some scripting to export the json(Export Everything) file from Kibana UI and it mush be Headless as I would be scheduling this script in linux server. To be headless, I also tried phantomjs, but even this doesn't support file download.

Simply, I just want a script to automate clicking export everything button on kibana and want it be saved in a file. Please share your thoughts or any idea,  i'm trying this for days...
0
HI Expert

In my application a button click must open a page ( inside a frame) , manually the chrome browser loads the page withing  1 minute
but same action does not happen with the Selenium Web Driver Script ( button is clicked , but the page inside the frame does not load)

page loading will be  in progress infinitely,

Please suggest the workaround

I am using chrome version : 58.0.3029.110 (64-bit)
chrome driver version         : 2.29

Regards
Sai
0
Mouse hover not working in internet explorer and chrome browser in selenium java. I am using below code.

// to handle dynamic index of pencil we used it
                        int i = index + 1;
                        String xpathPencil = "//*[@id='listGroup0']/a[" + i + "]/span[1]/button/i";
                        WebElement pencil = driver.findElement(By.xpath(xpathPencil));
                        action.moveToElement(StatusFilterListBox1.get(index)).perform();
                        // System.out.println("pencil coming");
                        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
                        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
                        action.click(pencil).perform();
                        waitForSpinnerToDisappear();
0
public class test {

      
public static void main(String[] args) throws AWTException, IOException, InterruptedException {
      
      
       WebDriver driver;
       System.setProperty("webdriver.ie.driver","**");
            driver=new InternetExplorerDriver();
      
      


      driver.get("**");
      driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

       WebDriverWait waiting = new WebDriverWait(driver, 10);
            waiting.until(ExpectedConditions.presenceOfElementLocated(By.id("**")));
      driver.manage().window().maximize();
      
      driver.findElement(By.id("**")).click();
      
      driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);


      

      

      
      try {
             Robot robot = new Robot();
             robot.keyPress(KeyEvent.VK_F6);
      
             robot.keyRelease(KeyEvent.VK_F6);
            
             robot.keyPress(KeyEvent.VK_ENTER);
             robot.keyRelease(KeyEvent.VK_ENTER);
            
                 } catch (AWTException e) {
                    e.printStackTrace();
                  }
      

}

}

The requirement is:
open a webpage
Click on the excel icon to download the file.
then a popup appears.
upon clicking on F6 and enter the file gets saved.
the problem here is as soon the code is run, the robot class does not wait for the icon to be clicked. the steps are not occurring in sequence.
0
Scenario 1:
I have the below method which is common to 3 web elements. I am trying to create a common method in which I can pass any of the 3 web elements as needed so that the method is invoked.

public String clickMethod() throws InterruptedException {
    WebElement link = currentPage.findElement(By.xpath("......')]"));
    String href= link.getAttribute("href");
    return href;
}

I am not sure how to pass webelement as parameter and call in the Testcase. I use pageobject model. the webelement is in the page class and i am trying to call the method and assert in test class.

Scenario 2:
In another case I need to pass 2 web elements and run the same method.

My code is like the one below:

public boolean VerifyResultsAndSelect() throws InterruptedException {
    Webelement1.sendKeys("asdf");
    List<WebElement> selectlist = currentPage.findElements(By.cssSelector("....."));
    System.out.println(selectlist.size());
    if (selectlist.size() == 3) {
        selectlist.get(0).click();
        System.out.println(currentPage.getCurrentUrl());
    }

    return true;
}

i am not sure how to pass 2 webelements as parameters  and call in the Testcase. I use pageobject model. the webelement is in the page class and i am trying to call the method and assert in test class.
0

Selenium

Selenium is a portable software testing framework for web applications. Selenium provides a record/playback tool for authoring tests without learning a test scripting language (Selenium IDE). It also provides a test domain-specific language (Selenese) to write tests in a number of popular programming languages, including C#, Groovy, Java, Perl, PHP, Python, Ruby and Scala. The tests can then be run against most modern web browsers. Selenium deploys on Windows, Linux, and OS X platforms. It is open-source software, released under the Apache 2.0 license, and can be downloaded and used without charge.

Top Experts In
Selenium
<
Monthly
>