Search code examples
xvfbxdotool

Focus chrome window in linux when running using xvfb


I am using the following shell script for to get the focus on a specific chrome window:

#!/bin/sh

WIDId=`xdotool search "Test page"`
xdotool windowactivate --sync $WIDId
sleep 2
xdotool windowactivate $WIDId
xdotool key --clearmodifiers ctrl+a

It works when running normally but fails when running chrome using xvfb. In xvfb it is unable to find the windowID. I need it to get working with xvfb.


Solution

  • It worked even without using windowactivate because I opened just one window that needed focus.