Please post your Web Driver questions in official Web Driver forum

Monday, February 13, 2017

Thank you all !!!

As you all know few days ago my youtube channel was suspended. This was shocking since I never received any strike against my channel from google.

I did not keep quiet and requested google to reactivate my channel and all of you have been very supportive in letting google know about importance of my channel. Today I got an email from google that my channel is active again.

I want to show my gratitude to all of you for your support. Without you asking google to activate my channel, my channel would yet have been suspended.

Thank you all and learning journey continues :)

Sunday, January 22, 2017

Petition to Google to Reactivate my YouTube Account

I have been writing blogs and creating videos in the field of software testing for about 8 years. During this period I have helped thousands to software testing enthusiasts in learning test automation. I woke up to a shock yesterday that my you tube channel has been terminated. This is what you will see on my youtube channel -


In my best of knowledge - 
  • I never spammed any one
  • Never used abusive language against any one.
  • Never had any strike against my account. 
The worse thing is that I have no backup of my video tutorial so all of my subscribes are going to be deprived of my video tutorials in future. 

According to google, account owner is sent an email when account is terminated but I never received any mail. I regularly receive you tube promotional mail so it is highly unlikely that I would have missed this email. I have already appealed google about it and yet waiting to hear from them. 

How can you help?

If you think that my channel has been of any help to you then -

  • Please add your comments to following post. Probably this helps google understand the importance of my channel and reactivate it.

Thanks for your support
  

Thursday, December 8, 2016

File upload and WebDriver (Where is my File?)

You may have come across file upload use case when working with WebDriver. File upload 
is quite easy since it is same as typing in a text box but herein we need to pass path of file
to be uploaded. I used to keep a static file in src/test/resources folder of maven project and 
would use it for upload operation. But you can also generate file during run time using 
java.nio.file.Files class.  Files class has createTempFile(java.lang.String, java.lang.String, java.nio.file.attribute.FileAttribute...) method which can be used to generate temporary files. For ex, you can generate a temporary pdf file and get back the File object as following - 

File file = Files.createTempFile("test-" + accountNumber, ".pdf").toFile();
generatePDF(file, StringUtils.repeat("Dummy PDF", 10));
And this is how generatePDF looks -
public static File generatePDF(File file, String content) {
    try {
        Document e = new Document();
        PdfWriter.getInstance(e, new FileOutputStream(file));
        e.open();
        e.add(new Paragraph(content));
        e.close();
        return file;
    } catch (FileNotFoundException | DocumentException var3) {
        throw new RuntimeException(var3);
    }
}

Now you can get absolute path of file and pass it to upload text box -  

getDriver.findElement(byLocator).sendKeys(file.getAbsolutePath());

Following this approach you don't have to keep a static file on my project.
So how do you handle file for file upload operation?
Fork me on GitHub