how to check if a specific UI element is in focus apple script
This definitely works on my system running Alfred 3.  You may need to adjust the delay times but as they are now, this script works for me.

activate application "Alfred Preferences"
delay 1.5
tell application "System Events"
    tell process "Alfred Preferences"
        click button "Features" of toolbar 1 of window "Alfred Preferences" of application process "Alfred Preferences" of application "System Events"
        delay 1
        set selected of row 3 of table 1 of scroll area 1 of window "Alfred Preferences" of application process "Alfred Preferences" of application "System Events" to true
        delay 1
        click button "Add Custom Search" of tab group 1 of window "Alfred Preferences" of application process "Alfred Preferences" of application "System Events"
    end tell
end tell