is it possible to customize "random user agent"?


  • Donator

    in configs>other options>selenium
    there is "use random user agent" option, is it possible to configure it?
    i want to use mobile/desktop user agent mixed (mostly mobile)



  • Try to make a function or a script that chooses from a selected User Agents randomly.



  • HI, i'am also blocked, I try to pass an input to the function 'GenRandomUA' for selenium browser (in firefox) but doesn't work.

    loliscript:
    UTILITY File "Files/MobileUA.txt" ReadLines -> VAR "UAList"
    UTILITY List "UAList" Random -> CAP "RndUA"
    FUNCTION GetRandomUA BROWSER Firefox "<RndUA>"

    Log:
    <--- Executing Block UTILITY --->
    Executed action ReadLines on file Files/MobileUA.txt
    <--- Executing Block UTILITY --->
    Executed action Random on file UAList
    <--- Executing Block FUNCTION --->
    Executed function GetRandomUA on input Mozilla/5.0 (Linux; Android 8.0.0; SAMSUNG SM-G955F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/8.2 Chrome/63.0.3239.111 Mobile Safari/537.36 with outcome Mozilla/5.0 (Windows NT 6.2; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
    Parsed variable | Name: | Value: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0

    The user-agent mobile as correctly loaded in 'input' but the 'outcome' is 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0'
    This exemple was just for testing but I known this is the wrong way to go. I cannot use the request block because it doesn't load javascript and I need to change user-agent randomly for every time the script start.
    Sorry for me bad English, thx for your help !



  • @Kyori said in is it possible to customize "random user agent"?:

    UTILITY File "Files/MobileUA.txt" ReadLines -> VAR "UAList"
    UTILITY List "UAList" Random -> CAP "RndUA"
    FUNCTION GetRandomUA BROWSER Firefox "<RndUA>"

    This is the option to use custom User-Agent on Selenium 👇

    SleniunCustonUAgent.png



  • yes but it requires a manual action to change, by assigning it to the user-agent as you show on the screen, it will not be random..
    I try to change "CustomUserAgent" directly from the .loli but this is not taken into account when the config is running in the runner..



  • OB2 will natively support that. Ruri said it



  • OB1 dont support random UA on selenium


Log in to reply