Re: [Sikuli-driver] [Question #697621]: Need to check how to use sikuli with Selenium in Docker
Question #697621 on SikuliX changed: https://answers.launchpad.net/sikuli/+question/697621 Status: Answered => Solved Milind Warade confirmed that the question is solved: Thanks RaiMan -- You received this question notification because your team Sikuli Drivers is an answer contact for SikuliX. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
[Sikuli-driver] [Question #697621]: Need to check how to use sikuli with Selenium in Docker
New question #697621 on SikuliX: https://answers.launchpad.net/sikuli/+question/697621 Hello, I am using Selenium and Sikuli in Windows and Ubantu in Java programing. For example, I am giving other sample code. package com.sikuli.demo; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.sikuli.script.FindFailed; import org.sikuli.script.Pattern; import org.sikuli.script.Screen; import org.openqa.selenium.chrome.ChromeDriver; public class SikuliDemo { public static void main(String[] args) throws FindFailed { System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe"); String filepath = "D:\\Guru99Demo\\Files\\"; String inputFilePath = "D:\\Guru99Demo\\Files\\"; Screen s = new Screen(); Pattern fileInputTextBox = new Pattern(filepath + "FileTextBox.PNG"); Pattern openButton = new Pattern(filepath + "OpenButton.PNG"); WebDriver driver; // Open Chrome browser driver = new ChromeDriver(); driver.get("http://demo.guru99.com/test/image_upload/index.php;); // Click on Browse button and handle windows pop up using Sikuli driver.findElement(By.xpath(".//*[@id='photoimg']")).click(); s.wait(fileInputTextBox, 20); s.type(fileInputTextBox, inputFilePath + "Test.docx"); s.click(openButton); // Close the browser driver.close(); } } I need to execute code in Docker (installed Docker on Ubanu machine). Using one docker file as of now. docker pull selenium/standalone-chrome If you can suggest how to integrated Sikuli in any docker image it will great. ( like selenium-chrome base image..need to integrate Sikuli with the same) Basically, i have created few keyword driven framework which is using Selenium and Sikuli. But, if I need to execute in docker ...need to check how both selenium and sikuli work together. Please do needful help. Thanks -- You received this question notification because your team Sikuli Drivers is an answer contact for SikuliX. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #665547]: Facing issue while taking screenshots for failed cases using Sikulix1.1.1
Question #665547 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/665547 Milind Warade posted a new comment: Thanks Raiman. Will check. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
[Sikuli-driver] [Question #665547]: Facing issue while taking screenshots for failed cases using Sikulix1.1.1
New question #665547 on Sikuli: https://answers.launchpad.net/sikuli/+question/665547 @Raiman: I am facing issue while taking screenshots for failed cases. I have went through : https://answers.launchpad.net/sikuli/+question/259679 Code- from sikuli import * import unittest import sys _path = r"D:\Sikulix\HTMLTestRunner" sys.path.append(_path) import HTMLTestRunner class TestDemo(unittest.TestCase): def testA(self): click("1520869861593.png") def testB(self): click("1520958741130.png") //This is wrong image class TestDemo2(unittest.TestCase): def testC(self): click("1520869861593.png") def testD(self): click("1520869861593.png") def suite(): suite = unittest.TestSuite() # TestDemo suite.addTest(TestDemo('testA')) suite.addTest(TestDemo('testB')) # TestDemo2 suite.addTest(TestDemo2('testC')) suite.addTest(TestDemo2('testD')) return suite suite = unittest.TestLoader().loadTestsFromTestCase(TestDemo) outfile = open("D:\\Sikulix\\HTMLTestRunner\\report.html", "w") # path to report folder runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title=' Test project', description='Test Report' ) runner.run(suite) I have taken htmltestrunner.py from Sikulix 1.1.1 (\\sikulix\Lib\htmltestrunner.py) where below part is there for taking screenshot of failed cases- def addFailure(self, test, err): self.failure_count += 1 TestResult.addFailure(self, test, err) _, _exc_str = self.failures[-1] output = self.complete_output() self.result.append((1, test, output, _exc_str, self.generateTestScreenshot(test))) # modified by RaiMan if self.verbosity > 1: sys.stderr.write('F ') sys.stderr.write(str(test)) sys.stderr.write('\n') else: sys.stderr.write('F') # added by RaiMan def generateTestScreenshot(self, test): imgdir = '' imgpath = '' if imgdir: x = str(test).split() tf = x[0] tc = x[1].split('.')[1][:-1] imgpath = os.path.join(imgdir, "%s-%s.png"%(tc, tf)) shutil.move(capture(SCREEN), imgpath) return imgpath But when I am executing test suite, it was not taking screenshots of failed cases. Please help me in this case. -- You received this question notification because your team Sikuli Drivers is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #211380]: Not able to close the text file in main script when opened in def()
Question #211380 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/211380 Status: Answered = Solved Milind Warade confirmed that the question is solved: Thanks RaiMan, that solved my question. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
[Sikuli-driver] [Question #211347]: How to increment values in array
New question #211347 on Sikuli: https://answers.launchpad.net/sikuli/+question/211347 Hi, I am writing code, in which text file is used as : (11,50,12) (11,52,21) (12,15,20) (12,30,45) Check the script: def myHandler(event): wait(2) click(1349867277615-1.png) type('v', KeyModifier.CTRL) wait(2) until = list(time.localtime()) until[3:6]=eval(arr[1]) # hour minute second # DON'T KNOW HOW TO HANDLE THE ARR IN INCREMENTAL timeUntil = time.mktime(tuple(until)) timeToWait = int(timeUntil - time.time()) if timeToWait 1: timeToWait1 = (86400 + int(timeUntil - time.time())) wait(timeToWait1) else: wait(timeToWait) click(submit-2.png) wait(8) click(clear-1.png) wait(2) # Main function setThrowException(True) wait(2) import array arr=[] f=open(D:\\DPTT_XML\\Time.txt,r) fout = open(D:\\DPTT_XML\\Time-results.txt,w) for line in f.readlines(): arr.append(line.strip()) # get rid of newline f.close() wait(2) click(1348813496420-12.png) wait(1) # For clock in for Employee E3 type(D:\\DPTT_XML\\E3.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(1) # Open firefox click(1348813496420-12.png) wait(5) click(earthprogram-9.png) type(firefox + Key.ENTER) wait(5) type(t, KeyModifier.CTRL) wait(5) type(https://localhost:9043/IDS/TestIDS.jsp; + Key.ENTER) wait(RequestXMLRe-3.png,20) click(DSservi0ehds-1.png) type(Key.END ) type (Key.BACKSPACE) type(http://localhost:9080/IDS/service/ids/;) type(Key.TAB) type('v', KeyModifier.CTRL) wait(2) until = list(time.localtime()) until[3:6]=eval(arr[0]) # hour minute second # HERE I AM GETTING VALUE FROM ARR [0] AS I HAVE NOT CALLED THE myhandler timeUntil = time.mktime(tuple(until)) timeToWait = int(timeUntil - time.time()) if timeToWait 1: timeToWait1 = (86400 + int(timeUntil - time.time())) wait(timeToWait1) else: wait(timeToWait) click(submit-2.png) wait(8) click(clear-1.png) wait(2) # For clock in for Employee E6 click(1348813496420-12.png) wait(1) type(D:\\DPTT_XML\\E6.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(2) onAppear(submitclear.png, myHandler) # HERE I WANT IT SHOULD TAKE VALUE FROM ARR [1] observe(10) wait(2) # For clock in for Employee E5 click(1348813496420-12.png) wait(1) type(D:\\DPTT_XML\\E5.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(2) onAppear(submitclear.png, myHandler) # HERE I WANT IT SHOULD TAKE VALUE FROM ARR [2] observe(10) wait(2) # For clock in for Employee E2 click(1348813496420-12.png) wait(1) type(D:\\DPTT_XML\\E2.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(2) onAppear(submitclear.png, myHandler) # HERE I WANT IT SHOULD TAKE VALUE FROM ARR [3] observe(10) wait(2) Not able to increment the array values when handler is used. Please help me out. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #211347]: How to increment values in array
Question #211347 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/211347 Milind Warade posted a new comment: Thanks Raiman. Problem is solved. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
[Sikuli-driver] [Question #211380]: Not able to close the text file when array is used.
New question #211380 on Sikuli: https://answers.launchpad.net/sikuli/+question/211380 Hi, I want to write the text file when I have used array. It was giving me error as : my_file.close() NameError: name 'my_file' is not defined == Check the code: # Game ended def Employee(event): wait(1) click(FEmployeeCod-9.png) wait(1) type(event.region.currentTimeEntry) wait(1) el = \n # the end of line you want to use my_file=file(D:\DPTT_XML\DPWrite.txt, w) if exists (ULUNPAID-7.png): type(UL) my_file.write(UL+el) # if you want to have line breaks wait(2) if exists (WOWEEKLYOFF-7.png): type(WO) my_file.write(WO+el) # if you want to have line breaks wait(2) wait(1) # Main function # Go to Portal for checking Employee Attendance report import array DPRead=[] f=open(D:\\DPTT_XML\\DPRead.txt,r) fout = open(D:\\DPTT_XML\\DPRead-results.txt,w) for line in f.readlines(): DPRead.append(line.strip()) # get rid of newline f.close() wait(2) click(1348813496420-5.png) wait(5) click(earthprogram-5.png) type(firefox + Key.ENTER) wait(5) type(t, KeyModifier.CTRL) wait(10) type(https://localhost:9080/index.action; + Key.ENTER) wait(LoginUsernam-5.png,20) click(Username-5.png) type(ABCD) click(Password-5.png) type(1234) wait(2) # Employee code for E1 : abhileft1 wait(2) SCREEN.currentTimeEntry = DPRead[2] onAppear(FEmployeeCod-9.png, Employee) observe(50) wait(1) # Employee code for E1 : abhileft2 click(VEmployeeCod.png) wait(2) SCREEN.currentTimeEntry = DPRead[3] onAppear(FEmployeeCod-9.png, Employee) observe(50) my_file.close()# ERROR OCCURS AT THIS STAGE wait(2) App.close(Firefox) wait(3) Please do needful help. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #210841]: Not able to read from text file when timestamp is used
Question #210841 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/210841 Status: Solved = Open Milind Warade is still having a problem: Hi , I am again not able to read the time from the text file. When there are two lines say, (19, 45, 08) (19, 46, 10) then it was working in fine manner. But in below script it was not working. I have given text file Time.txt as: (19, 45, 08) (19, 46, 10) (19, 47, 08) (19, 48, 10) (19, 49, 08) (19, 50, 10) (19, 51, 08) (19, 52, 10) (19, 53, 08) (19, 54, 10) (19, 55, 08) (19, 56, 10) (19, 57, 08) (19, 58, 10) My script is: wait(2) import array arr=[] f=open(D:\\DPTT_XML\\Time.txt,r) fout = open(D:\\DPTT_XML\\Time-results.txt,w) for line in f.readlines(): arr.append(line.strip()) # get rid of newline f.close() wait(2) click(1348813496420-4.png) wait(1) # For clock in for Employee E3 type(D:\\DPTT_XML\\E3.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(1) # Open firefox click(1348813496420-4.png) wait(5) click(earthprogram-7.png) type(firefox + Key.ENTER) wait(5) type(t, KeyModifier.CTRL) wait(5) type(https://ABCD:80/IDS/TestIDS.jsp; + Key.ENTER) wait(RequestXMLRe-1.png,20) type(Key.TAB + Key.TAB) type('v', KeyModifier.CTRL) wait(2) until = list(time.localtime()) until[3:6] = eval(arr[0]) # hour minute second timeUntil = time.mktime(tuple(until)) timeToWait = int(timeUntil - time.time()) if timeToWait 1: timeToWait1 = (86400 + int(timeUntil - time.time())) wait(timeToWait1) else: wait(timeToWait) click(submit-1.png) wait(8) click(clear.png) wait(2) # For clock in for Employee E6 click(1348813496420-4.png) wait(1) type(D:\\DPTT_XML\\E6.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(2) click(1349867277615.png) type('v', KeyModifier.CTRL) wait(2) until = list(time.localtime()) until[3:6] = eval(arr[1]) # hour minute second timeUntil = time.mktime(tuple(until)) timeToWait = int(timeUntil - time.time()) if timeToWait 1: timeToWait1 = (86400 + int(timeUntil - time.time())) wait(timeToWait1) else: wait(timeToWait) click(submit-1.png) wait(8) click(clear.png) wait(2) # For clock in for Employee E5 click(1348813496420-4.png) wait(1) type(D:\\DPTT_XML\\E5.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(2) click(1349867277615.png) type('v', KeyModifier.CTRL) wait(2) until = list(time.localtime()) until[3:6] = eval(arr[2]) # hour minute second timeUntil = time.mktime(tuple(until)) timeToWait = int(timeUntil - time.time()) if timeToWait 1: timeToWait1 = (86400 + int(timeUntil - time.time())) wait(timeToWait1) else: wait(timeToWait) click(submit-1.png) wait(8) click(clear.png) wait(2) # For clock in for Employee E2 click(1348813496420-4.png) wait(1) type(D:\\DPTT_XML\\E2.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(2) click(1349867277615.png) type('v', KeyModifier.CTRL) wait(2) until = list(time.localtime()) until[3:6] = eval(arr[3]) # hour minute second timeUntil = time.mktime(tuple(until)) timeToWait = int(timeUntil - time.time()) if timeToWait 1: timeToWait1 = (86400 + int(timeUntil - time.time())) wait(timeToWait1) else: wait(timeToWait) click(submit-1.png) wait(8) click(clear.png) wait(2) # For clock in for Employee E3 click(1348813496420-4.png) wait(1) type(D:\\DPTT_XML\\E3.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(2) click(1349867277615.png) type('v', KeyModifier.CTRL) wait(2) until = list(time.localtime()) until[3:6] = eval(arr[4]) # hour minute second timeUntil = time.mktime(tuple(until)) timeToWait = int(timeUntil - time.time()) if timeToWait 1: timeToWait1 = (86400 + int(timeUntil - time.time())) wait(timeToWait1) else: wait(timeToWait) click(submit-1.png) wait(8) click(clear.png) wait(2) # For clock in for Employee E7 click(1348813496420-4.png) wait(1) type(D:\\DPTT_XML\\E7.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(2) click(1349867277615.png) type('v', KeyModifier.CTRL) wait(2) until = list(time.localtime()) until[3:6] = eval(arr[5]) # hour minute second timeUntil = time.mktime(tuple(until)) timeToWait = int(timeUntil - time.time()) if timeToWait 1: timeToWait1 = (86400 + int(timeUntil - time.time())) wait(timeToWait1) else: wait(timeToWait) click(submit-1.png) wait(8) click(clear.png) wait(2) # For clock in for Employee E8 click(1348813496420-4.png) wait(1) type(D:\\DPTT_XML\\E8.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(2) click(1349867277615.png) type('v', KeyModifier.CTRL) wait(2) until
Re: [Sikuli-driver] [Question #210841]: Not able to read from text file when timestamp is used
Question #210841 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/210841 Status: Answered = Solved Milind Warade confirmed that the question is solved: My problem was solved. Thanks Raiman. I will try to optimize the code. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #210756]: Not able to write the text file.
Question #210756 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/210756 Status: Needs information = Open Milind Warade gave more information on the question: Hi Raviman, Thanks for reply. No error message occurs when I have tried to run the script. It was reading from text file in good manner. But when I want to write it, then not working. No error is there. In my case: In sikuly message, it was showing [log] TYPE UL but in the file I am not able to write it. At that time all the images are present. I have given wait time for it. And if I execute only, wait(2) if exists (ULUNPAID-5.png): type(UL) my_dir = D:\\ el = \n # the end of line you want to use my_file=file(my_dir + DPWrite.txt, w) my_file.write(UL+el) # if you want to have line breaks wait(2) if exists (WOWEEKLYOFF-5.png): type(WO) my_file.write(WO+el) # if you want to have line breaks wait(2) if exists (CLCASUAL-5.png): type(CL) my_file.write(CL+el) # if you want to have line breaks wait(2) if exists (PFPresentFul-4.png): type(PF) my_file.write(PF+el) # if you want to have line breaks my_file.close() wait(2) wait(2) then I am able to write the text file DPWrite.txt -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #210756]: Not able to write the text file.
Question #210756 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/210756 Status: Answered = Open Milind Warade is still having a problem: Thanks Raiman. Problem is solved. Now I am able to write the text file. How to use wait(target Time - time Now) in Sikuli. I have found this within one questions which is answered by you. I have to fire particular command at specified time only. say I have started script at 11:00 AM and I want to wait till 02:15:50 PM for particular command . Then how to use it. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #210756]: Not able to write the text file.
Question #210756 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/210756 Status: Open = Solved Milind Warade confirmed that the question is solved: Thanks Raiman. Problem is solved. Now I am able to write the text file. How to use wait(target Time - time Now) in Sikuli. I have found this within one questions which is answered by you. I have to fire particular command at specified time only. say I have started script at 11:00 AM and I want to wait till 02:15:50 PM for particular command . Then how to use it. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #210756]: Not able to write the text file.
Question #210756 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/210756 Milind Warade posted a new comment: Thanks Raiman, That's solved my issue. Thanks again. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
[Sikuli-driver] [Question #210841]: Not able to read from text file when timestamp is used
New question #210841 on Sikuli: https://answers.launchpad.net/sikuli/+question/210841 Dear, I have one text file Time.txt which contents data like: 18, 50, 50 19, 25, 56 Then I have write script in which I want take the data from text file line by line. wait(2) import array arr=[] f=open(D:\\DPTT_XML\\Time.txt,r) fout = open(D:\\DPTT_XML\\Time-results.txt,w) for line in f.readlines(): arr.append(line.strip()) # get rid of newline f.close() wait(2) click(1348813496420-5.png) wait(1) # For clock in for Employee E3 type(D:\\DPTT_XML\\E3.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(1) # Open firefox click(1348813496420-5.png) wait(5) click(earthprogram-8.png) type(firefox + Key.ENTER) wait(5) type(t, KeyModifier.CTRL) wait(5) type(http://abcd:80/Test.jsp; + Key.ENTER) wait(RequestXMLRe-2.png,20) type(Key.TAB + Key.TAB) type('v', KeyModifier.CTRL) wait(2) until = list(time.localtime()) until[3:6] = (arr[0]) # hour minute second timeUntil = time.mktime(tuple(until)) timeToWait = int(timeUntil - time.time()) wait (timeToWait) click(submit-2.png) wait(2) click(clear-1.png) wait(2) # For clock in for Employee E6 click(1348813496420-5.png) wait(1) type(D:\\DPTT_XML\\E6.txt) wait(1) type(Key.ENTER) wait(1) type('a', KeyModifier.CTRL) type('c', KeyModifier.CTRL) type(Key.F4, KeyModifier.ALT) wait(2) click(1349867277615-1.png) type('v', KeyModifier.CTRL) wait(2) until = list(time.localtime()) until[3:6] = (arr[1]) # hour minute second timeUntil = time.mktime(tuple(until)) timeToWait = int(timeUntil - time.time()) wait (timeToWait) click(submit-2.png) wait(2) click(clear-1.png) wait(2) Error occurs as: [log] CLICK on (28,748) [log] TYPE D:\DPTT_XML\E3.txt [log] TYPE [log] Ctrl+TYPE a [log] Ctrl+TYPE c [log] Alt+TYPE ? [log] CLICK on (28,748) [log] CLICK on (101,695) [log] TYPE firefox [log] Ctrl+TYPE t [log] TYPE http://abcd:80/Test.jsp [log] TYPE [log] Ctrl+TYPE v [error] Stopped [error] An error occurs at line 37 [error] Error message: Traceback (most recent call last): File C:\Users\milindw\AppData\Local\Temp\sikuli-tmp6010284413651765971.py, line 37, in timeUntil = time.mktime(tuple(until)) OverflowError: an integer is required But when I have tried by writing : from until[3:6] = (arr[0]) # hour minute second To until[3:6] = (18, 30, 56) # hour minute second Then it works. But I don't know why it was not picking value from text file. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
[Sikuli-driver] [Question #210756]: Not able to write the text file.
New question #210756 on Sikuli: https://answers.launchpad.net/sikuli/+question/210756 Dear friend, I have doing read and write text file using sikuli. See the following example. setThrowException(True) import array arr=[] f=open(D:\DPRead.txt,r) fout = open(D:\DPRead-results.txt,w) for line in f.readlines(): arr.append(line.strip()) # get rid of newline f.close() wait(2) click(1348813496420-3.png) wait(5) click(earthprogram-3.png) type(firefox + Key.ENTER) wait(5) type(t, KeyModifier.CTRL) wait(5) type(http://abcd/index.action; + Key.ENTER) wait(LoginUsernam-3.png,20) click(Username-3.png) type(adminani) click(Password-3.png) type(Password1) click(1349777086675-3.png) wait(2) wait(1349777342392-3.png,200) click(Reports-3.png) wait(1) click(EmployeeAtte-7.png) wait(EmployeeAtte-6.png,90) click(00-5.png) wait(2) type(Key.RIGHT + Key.RIGHT + Key.RIGHT + Key.RIGHT +Key.RIGHT ) type(Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE+ Key.BACKSPACE) wait(2) type(arr[0]) wait(2) click(235959-4.png) wait(2) type(Key.RIGHT + Key.RIGHT + Key.RIGHT + Key.RIGHT +Key.RIGHT ) type(Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE + Key.BACKSPACE+ Key.BACKSPACE) wait(2) type(arr[1]) wait(2) click(FEmployeeCod-6.png) wait(2) type(Key.TAB) wait(2) type(arr[2]) wait(2) type(Key.TAB) wait(2) click(ShowAttendan-3.png ) wait(10) type(Key.PAGE_DOWN + Key.PAGE_DOWN) wait(2) if exists (ULUNPAID-5.png): type(UL) my_dir = D:\\ el = \n # the end of line you want to use my_file=file(my_dir + DPWrite.txt, w) my_file.write(UL+el) # if you want to have line breaks wait(2) if exists (WOWEEKLYOFF-5.png): type(WO) my_file.write(WO+el) # if you want to have line breaks wait(2) if exists (CLCASUAL-5.png): type(CL) my_file.write(CL+el) # if you want to have line breaks wait(2) if exists (PFPresentFul-4.png): type(PF) my_file.write(PF+el) # if you want to have line breaks my_file.close() wait(2) wait(2) In this I am able to read the file ..i.e. DPRead.txt But I am not able to write the DPWrite.txt I have only execute following sikuli script: wait(2) if exists (ULUNPAID-5.png): type(UL) my_dir = D:\\ el = \n # the end of line you want to use my_file=file(my_dir + DPWrite.txt, w) my_file.write(UL+el) # if you want to have line breaks wait(2) if exists (WOWEEKLYOFF-5.png): type(WO) my_file.write(WO+el) # if you want to have line breaks wait(2) if exists (CLCASUAL-5.png): type(CL) my_file.write(CL+el) # if you want to have line breaks wait(2) if exists (PFPresentFul-4.png): type(PF) my_file.write(PF+el) # if you want to have line breaks my_file.close() wait(2) wait(2) then I am able to write the text file DPWrite.txt Que1: Why I am not able to write the text file. Que2: Is there any way to read and write same file. - I have tried it. But does not work. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp