Jump to content



Photo

Change Checkbox Command

change checkbox csv

  • Please log in to reply
4 replies to this topic

#1 mj1231

mj1231

    Newbie

  • Members
  • Pip
  • 7 posts
  • OS:Windows 8
  • Total Memory:< 1Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 09 June 2017 - 12:58 AM

I want to automate adding products to an ecommerce site, I have a list of products in a csv file, the fields includes code, product name, price, size and color. Now the ecommerce site has a list of colors and use checkbox element for selecting color. My biggest challenge is how to get the value from csv and let ubot check the checkbox of the appropriate color. Does anyone know how to do it? I'm new to ubot. Thanks ahead!



#2 Code Docta (Nick C.)

Code Docta (Nick C.)

    Member for Hire

  • Fellow UBotter
  • PipPipPip
  • 1482 posts
  • LocationIn a Python or UBot IDE or ubotdocta.com
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 09 June 2017 - 06:29 AM

This should help

 

http://network.ubots...-from-csv-file/


UBot Expert Tutorials Store

 

ubot-docta-header-ubot-expert-store.png

 

Python and UBot expert tutorials and documentation


#3 HelloInsomnia

HelloInsomnia

    Advanced Member

  • Moderators
  • 3067 posts
  • OS:Windows 10
  • Total Memory:More Than 9Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 09 June 2017 - 12:03 PM

Here is an example of how you can do this, it may not be the exact same on your webpage but hopefully this gives you an idea on how to achieve this:

navigate("https://ubotstudio.com/site/playground-difficult-form/","Wait")
wait(2)
clear table(&colors)
set table cell(&colors,0,0,"Yellow")
set table cell(&colors,1,0,"Red")
set table cell(&colors,2,0,"Pink")
set(#row,0,"Global")
loop($table total rows(&colors)) {
    set(#color,$table cell(&colors,#row,0),"Global")
    if($exists(<(type="checkbox" AND value=#color)>)) {
        then {
            change checkbox(<(type="checkbox" AND value=#color)>,"Checked")
        }
        else {
        }
    }
    increment(#row)
}


#4 mj1231

mj1231

    Newbie

  • Members
  • Pip
  • 7 posts
  • OS:Windows 8
  • Total Memory:< 1Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 13 June 2017 - 12:53 AM

Thanks for the idea HelloInsomnia! its working now!



#5 mj1231

mj1231

    Newbie

  • Members
  • Pip
  • 7 posts
  • OS:Windows 8
  • Total Memory:< 1Gb
  • Framework:v4.5+, unsure
  • License:Developer Edition

Posted 13 June 2017 - 12:55 AM

 

Here is an example of how you can do this, it may not be the exact same on your webpage but hopefully this gives you an idea on how to achieve this:

navigate("https://ubotstudio.com/site/playground-difficult-form/","Wait")
wait(2)
clear table(&colors)
set table cell(&colors,0,0,"Yellow")
set table cell(&colors,1,0,"Red")
set table cell(&colors,2,0,"Pink")
set(#row,0,"Global")
loop($table total rows(&colors)) {
    set(#color,$table cell(&colors,#row,0),"Global")
    if($exists(<(type="checkbox" AND value=#color)>)) {
        then {
            change checkbox(<(type="checkbox" AND value=#color)>,"Checked")
        }
        else {
        }
    }
    increment(#row)
}

Thanks for the idea HelloInsomnia! its working now!







Also tagged with one or more of these keywords: change checkbox, csv

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users