Advertisement
Guest User

Untitled

a guest
Apr 29th, 2019
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. const Copperfield = require("copperfield_ceic");
  2. var copperfield = new Copperfield({
  3. viewport: {
  4. width: 1920,
  5. height: 1080,
  6. isMobile: false
  7. },
  8. puppeteer: {
  9. timeout: 15 * 60 * 1000
  10. }
  11. });
  12.  
  13. const username = 'proxy@emis.com';
  14. const password = 'zaq1%40WSX!QAZ';
  15.  
  16. var files1 = {
  17. "table1.html": {
  18. "radioXPath": ".//input[@id='radioExp']",
  19. "valueXPath": ".//input[@id='radioRs']"
  20. }
  21. }
  22.  
  23. var siteUrl = "https://commerce-app.gov.in/ftpa/rgncntq.asp";
  24. var submitButtnXPath = ".//input[@id='button1']";
  25.  
  26. copperfield
  27. .headless(false)
  28. .retry(10)
  29. .die(true)
  30. .blacklist(['.css', '.png', '.gif', '.jpeg', 'google-analytics', 'yandex'])
  31. .clientScripts([])
  32. //.proxy("in.c1168256407.saasprotection.com:8080")
  33. .steps(async function (parameters) {
  34. // await this.page.authenticate({username, password});
  35. await this.open(siteUrl, 30*1000, 'domcontentloaded');
  36. console.log("navigated")
  37. await this.simWaitAndClick(parameters.radioXPath, 5000, 'load', false);
  38. await this.simWaitAndClick(parameters.valueXPath, 5000, 'load', false);
  39. console.log("clicked on radio")
  40. await this.waitAndClick(".//input[contains(@type, 'submit')]", 5000, 'load', false);
  41. console.log("clicked on submit")
  42. // await this.evaluate(function(){
  43. // $("#busqueda > div.seleccion > div.tipo_informacion > div.select > select").val(1);
  44. // $("#busqueda > div.seleccion > div.tipo_informacion > div.select > select").change();
  45. // })
  46. await this.wait(3000);
  47. // await this.evaluate(function(){
  48. // $("#busqueda > div.seleccion > div.medida > div.select > select").val("[Measures].[ESTIMACION TRIM]");
  49. // $("#busqueda > div.seleccion > div.medida > div.select > select").change();
  50. // })
  51. // await this.wait(3000);
  52. // await this.evaluate(function(){
  53. // $("#O").click();
  54. // })
  55. // await this.wait(3000);
  56. // await this.evaluate(function(){
  57. // document.querySelectorAll("#AY")[1].click()
  58. // })
  59. // await this.wait(5000);
  60. // await this.waitAndClick(normalize("//a[contains(@title, 'Generar resultados')]"), 5000, 'load', false);
  61. // await this.wait(5000);
  62. // await this.evaluate(function(){
  63. // console.log("HERE!")
  64. // $("#btn_exportar").click();
  65. // })
  66.  
  67. await this.wait(1000);
  68.  
  69.  
  70. })
  71. .run(files1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement