Jump to content
UBot Underground

Recommended Posts

Hi,

 

I'm working on a bot that uploads files to various sites. The process is different the first time that a file is uploaded to when subsequent files are uploaded, for certain sites.

 

How do I set up my bot so that it can handle this? I imagine that I'd need to indicate that it is a first time upload on my UI but I don't know what to do, thereafter.

 

John  

Link to post
Share on other sites

John you really didn't give us (the community) much information to work from.

 

Put in your existing code snippets and it will be easier for more advanced users to help you get on the right track.

 

 

Without knowing more - I would say create a define for each of the different upload requirements, and then run those defines inline or in threads

  • Like 1
Link to post
Share on other sites
OK, so, here a few more details, which I hope will help :)

 

The bot uploads a PDF to a website for publication. I've replaced all references to the site in question with the word hidden in case they are not impressed.   The process differs at line 18 in the 2nd code [comment("click UPLOAD top right hand corner")] and then follows a slightly different process, thereafter. The first PDF uploaded uses the first set of code and all subsequent PDFs the second lot of code.

 

How would you normally deal with this situation? 

 

 

1st Code:

 

clear cookies


wait for browser event("DOM Ready","")

wait(3)

click($element offset(<login link>,1),"Left Click","No")

wait(2)

divider

comment("Add login details")

divider

type text(<username field>,#hiddenLogin,"Standard")

wait(2)

type text(<password field>,#hiddenPassword,"Standard")

wait(2)

click($element offset(<login button>,3),"Left Click","No")

wait for browser event("DOM Ready","")

wait(5)

divider

comment("click Publish on hidden")

divider

click(<data-header-nav-track-internal="upload">,"Left Click","No")

wait(5)

divider

comment("upload PDFvar which is the PDF file being distributed")

divider

click(<class="moduleWelcome__button ixu-button ixu-button--pronounced js-hackpathforloggedin">,"Left Click","No")

wait for browser event("DOM Ready","")

wait(5)

divider

comment("Upload PDFvar")

divider

change file field(<id="publish-select-btn">,#PDFvar)

divider

comment("Wait for the file to load. looks for Description Box.")

divider

wait for element(<id="description">,"","Appear")

divider

comment("Checks that the page has actually loaded after uploading the file.")

divider

wait(2)

type text(<name="title">,#PDFTitlevar,"Standard")

wait(2)

type text(<id="description">,#PDFDescription,"Standard")

wait(2)

click(<class="btn btn-success sel-publish-mode-selector-button-submit js-submit">,"Left Click","No")

 

 

2nd Code:

 

clear cookies


wait for browser event("DOM Ready","")

wait(3)

click($element offset(<login link>,1),"Left Click","No")

wait(2)

divider

comment("Add login details")

divider

type text(<username field>,#hiddenLogin,"Standard")

wait(2)

type text(<password field>,#hiddenPassword,"Standard")

wait(2)

click($element offset(<login button>,3),"Left Click","No")

wait for browser event("DOM Ready","")

wait(5)

divider

comment("click UPLOAD top right hand corner")

divider

click(<data-header-nav-track-internal="upload">,"Left Click","No")

wait(5)

divider

comment("upload PDFvar which is the PDF file being distributed")

divider

divider

comment("Upload PDFvar")

divider

change file field(<id="publish-select-btn">,#PDFvar)

divider

comment("Wait for the file to load. looks for Description Box.")

divider

wait for element(<id="description">,"","Appear")

divider

comment("Checks that the page has actually loaded after uploading the file.")

divider

wait(2)

type text(<name="title">,#PDFTitlevar,"Standard")

wait(2)

type text(<id="description">,#PDFDescription,"Standard")

stop script

wait(2)

click(<class="btn btn-success sel-publish-mode-selector-button-submit js-submit">,"Left Click","No")

 

 

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...