-1

how to create a new file in selenium ?

And also how can i write a data into the newly created file ?

How does selenium IDE & Selenium RC differs ?

Petr Janeček
  • 37,768
  • 12
  • 121
  • 145
Jackie James
  • 785
  • 8
  • 15
  • 28

2 Answers2

3

Assuming from your last question and your comments there, you want to get some text from a page and save it in a file.

I might be wrong, but I think you can't do that in Selenium IDE and will need the full power of a programming language in Selenium RC (which has been officially deprecated like a year ago) or Selenium WebDriver.

Once you're using one or another in any language you like (currently C#, Java, Ruby, Perl and PHP are supported), you can use the language's standard tools to write into a file.

Community
  • 1
  • 1
Petr Janeček
  • 37,768
  • 12
  • 121
  • 145
  • It's just a simple file ( either notepad or wordpad). I just want to create a new file & write data into it. how can i do it ? – – Jackie James Jun 13 '12 at 17:01
  • is there any comands like fopen, fread, fwrite ? or any other different commands ? – Jackie James Jun 13 '12 at 17:04
  • You need to check the documentation of whichever language bindings you are using for Selenium. If you can get the data through the Selenium language bindings, you can read and it write to a file using the standard methods for that language. – Mark Stosberg Jun 13 '12 at 19:16
  • @JackieJames No, you can't do it just using Selenium IDE. The list of all Selenium IDE's commands is [here](http://release.seleniumhq.org/selenium-core/1.0.1/reference.html). – Petr Janeček Jun 13 '12 at 19:41
  • @ Slanec : Thank u for the information. Then, how can i do it ? May i know the procedure for the same ? – Jackie James Jun 14 '12 at 03:29
  • @JackieJames Export your test case to the language of your choice, open it in your favourite IDE, compile it and run it to be sure the export worked, then implement a simple file write logic (refer to the links in my answer for that). – Petr Janeček Jun 14 '12 at 11:42
0

Regarding your file questions, it's not clear whether you are referring to test files, files on the Selenium server, or files on the clients which run the browsers driven by Selenium.

Regarding Selenium IDE vs RC, that question is already answered at:

What is the difference between Selenium IDE, Server, RC, 2.0, and WebDriver?.

Community
  • 1
  • 1
Mark Stosberg
  • 12,961
  • 6
  • 44
  • 49
  • @ Mark : It's just a simple file ( either notepad or wordpad). I just want to create a new file & write data into it. how can i do it ? – Jackie James Jun 13 '12 at 17:01
  • is there any comands like fopen, fread, fwrite ? or any other different commands ? – Jackie James Jun 13 '12 at 17:04
  • You still haven't said where the file is located: Is it on the machine where the tests are located, the machine where the selenium server is running, or the client machine where the browser is running? It also matters which component you are attempting to read or write the file from. – Mark Stosberg Jun 13 '12 at 17:14
  • I've to create a new file on desktop. I've to write data into it. Is it possible to do in selenium ? if so,what is the command ? – Jackie James Jun 13 '12 at 17:28
  • Is something like File.open(local_filename, 'w') {|f| f.write(doc) } possible ? – Jackie James Jun 13 '12 at 17:30
  • You want a web browser to write to a file on the desktop that you specify? I don't think it can be done, just as Firefox can't write to a file on your desktop. – Mark Stosberg Jun 13 '12 at 17:39
  • I'm currently executing a testcase in selenium after recording some actions. During this time, some of the values are stored in variables. I need to write these stored variables into separate file.Later appending second set dat for comparison. How can i do it ? – Jackie James Jun 13 '12 at 17:44